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        #[unsafe(method(duration))]
79        #[unsafe(method_family = none)]
80        pub unsafe fn duration(&self) -> NSTimeInterval;
81    );
82}
83
84/// Methods declared on superclass `HMEvent`.
85#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
86impl HMDurationEvent {
87    extern_methods!(
88        #[deprecated = "HMEvent is abstract"]
89        #[unsafe(method(new))]
90        #[unsafe(method_family = new)]
91        pub unsafe fn new() -> Retained<Self>;
92    );
93}
94
95extern_class!(
96    /// This class is used to represent a duration of time.
97    ///
98    /// See also [Apple's documentation](https://developer.apple.com/documentation/homekit/hmmutabledurationevent?language=objc)
99    #[unsafe(super(HMDurationEvent, HMTimeEvent, HMEvent, NSObject))]
100    #[derive(Debug, PartialEq, Eq, Hash)]
101    #[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
102    pub struct HMMutableDurationEvent;
103);
104
105#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
106unsafe impl Send for HMMutableDurationEvent {}
107
108#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
109unsafe impl Sync for HMMutableDurationEvent {}
110
111#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
112extern_conformance!(
113    unsafe impl NSCopying for HMMutableDurationEvent {}
114);
115
116#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
117unsafe impl CopyingHelper for HMMutableDurationEvent {
118    type Result = HMDurationEvent;
119}
120
121#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
122extern_conformance!(
123    unsafe impl NSMutableCopying for HMMutableDurationEvent {}
124);
125
126#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
127unsafe impl MutableCopyingHelper for HMMutableDurationEvent {
128    type Result = Self;
129}
130
131#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
132extern_conformance!(
133    unsafe impl NSObjectProtocol for HMMutableDurationEvent {}
134);
135
136#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
137impl HMMutableDurationEvent {
138    extern_methods!(
139        #[unsafe(method(init))]
140        #[unsafe(method_family = init)]
141        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
142
143        /// duration The duration of time in seconds.
144        #[unsafe(method(duration))]
145        #[unsafe(method_family = none)]
146        pub unsafe fn duration(&self) -> NSTimeInterval;
147
148        /// Setter for [`duration`][Self::duration].
149        #[unsafe(method(setDuration:))]
150        #[unsafe(method_family = none)]
151        pub unsafe fn setDuration(&self, duration: NSTimeInterval);
152    );
153}
154
155/// Methods declared on superclass `HMDurationEvent`.
156#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
157impl HMMutableDurationEvent {
158    extern_methods!(
159        /// Creates a duration time event.
160        ///
161        ///
162        /// Parameter `duration`: The duration of time in seconds.
163        ///
164        ///
165        /// Returns: Instance object representing the duration event.
166        #[unsafe(method(initWithDuration:))]
167        #[unsafe(method_family = init)]
168        pub unsafe fn initWithDuration(
169            this: Allocated<Self>,
170            duration: NSTimeInterval,
171        ) -> Retained<Self>;
172    );
173}
174
175/// Methods declared on superclass `HMEvent`.
176#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
177impl HMMutableDurationEvent {
178    extern_methods!(
179        #[deprecated = "HMEvent is abstract"]
180        #[unsafe(method(new))]
181        #[unsafe(method_family = new)]
182        pub unsafe fn new() -> Retained<Self>;
183    );
184}