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"))]
32unsafe impl NSCopying for HMDurationEvent {}
33
34#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
35unsafe impl CopyingHelper for HMDurationEvent {
36    type Result = Self;
37}
38
39#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
40unsafe impl NSMutableCopying for HMDurationEvent {}
41
42#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
43unsafe impl MutableCopyingHelper for HMDurationEvent {
44    type Result = HMMutableDurationEvent;
45}
46
47#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
48unsafe impl NSObjectProtocol for HMDurationEvent {}
49
50#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
51impl HMDurationEvent {
52    extern_methods!(
53        #[unsafe(method(init))]
54        #[unsafe(method_family = init)]
55        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
56
57        /// Creates a duration time event.
58        ///
59        ///
60        /// Parameter `duration`: The duration of time in seconds.
61        ///
62        ///
63        /// Returns: Instance object representing the duration event.
64        #[unsafe(method(initWithDuration:))]
65        #[unsafe(method_family = init)]
66        pub unsafe fn initWithDuration(
67            this: Allocated<Self>,
68            duration: NSTimeInterval,
69        ) -> Retained<Self>;
70
71        /// duration The duration of time in seconds.
72        #[unsafe(method(duration))]
73        #[unsafe(method_family = none)]
74        pub unsafe fn duration(&self) -> NSTimeInterval;
75    );
76}
77
78/// Methods declared on superclass `HMEvent`.
79#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
80impl HMDurationEvent {
81    extern_methods!(
82        #[deprecated = "HMEvent is abstract"]
83        #[unsafe(method(new))]
84        #[unsafe(method_family = new)]
85        pub unsafe fn new() -> Retained<Self>;
86    );
87}
88
89extern_class!(
90    /// This class is used to represent a duration of time.
91    ///
92    /// See also [Apple's documentation](https://developer.apple.com/documentation/homekit/hmmutabledurationevent?language=objc)
93    #[unsafe(super(HMDurationEvent, HMTimeEvent, HMEvent, NSObject))]
94    #[derive(Debug, PartialEq, Eq, Hash)]
95    #[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
96    pub struct HMMutableDurationEvent;
97);
98
99#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
100unsafe impl Send for HMMutableDurationEvent {}
101
102#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
103unsafe impl Sync for HMMutableDurationEvent {}
104
105#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
106unsafe impl NSCopying for HMMutableDurationEvent {}
107
108#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
109unsafe impl CopyingHelper for HMMutableDurationEvent {
110    type Result = HMDurationEvent;
111}
112
113#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
114unsafe impl NSMutableCopying for HMMutableDurationEvent {}
115
116#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
117unsafe impl MutableCopyingHelper for HMMutableDurationEvent {
118    type Result = Self;
119}
120
121#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
122unsafe impl NSObjectProtocol for HMMutableDurationEvent {}
123
124#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
125impl HMMutableDurationEvent {
126    extern_methods!(
127        #[unsafe(method(init))]
128        #[unsafe(method_family = init)]
129        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
130
131        /// duration The duration of time in seconds.
132        #[unsafe(method(duration))]
133        #[unsafe(method_family = none)]
134        pub unsafe fn duration(&self) -> NSTimeInterval;
135
136        /// Setter for [`duration`][Self::duration].
137        #[unsafe(method(setDuration:))]
138        #[unsafe(method_family = none)]
139        pub unsafe fn setDuration(&self, duration: NSTimeInterval);
140    );
141}
142
143/// Methods declared on superclass `HMDurationEvent`.
144#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
145impl HMMutableDurationEvent {
146    extern_methods!(
147        /// Creates a duration time event.
148        ///
149        ///
150        /// Parameter `duration`: The duration of time in seconds.
151        ///
152        ///
153        /// Returns: Instance object representing the duration event.
154        #[unsafe(method(initWithDuration:))]
155        #[unsafe(method_family = init)]
156        pub unsafe fn initWithDuration(
157            this: Allocated<Self>,
158            duration: NSTimeInterval,
159        ) -> Retained<Self>;
160    );
161}
162
163/// Methods declared on superclass `HMEvent`.
164#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
165impl HMMutableDurationEvent {
166    extern_methods!(
167        #[deprecated = "HMEvent is abstract"]
168        #[unsafe(method(new))]
169        #[unsafe(method_family = new)]
170        pub unsafe fn new() -> Retained<Self>;
171    );
172}