1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
/// Timer based trigger.
///
///
/// This class represents a trigger that is based on timers.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/homekit/hmtimertrigger?language=objc)
#[unsafe(super(HMTrigger, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "HMTrigger")]
pub struct HMTimerTrigger;
);
#[cfg(feature = "HMTrigger")]
unsafe impl Send for HMTimerTrigger {}
#[cfg(feature = "HMTrigger")]
unsafe impl Sync for HMTimerTrigger {}
#[cfg(feature = "HMTrigger")]
extern_conformance!(
unsafe impl NSObjectProtocol for HMTimerTrigger {}
);
#[cfg(feature = "HMTrigger")]
impl HMTimerTrigger {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
/// Initialize a new HMTimerTrigger object.
///
///
/// Parameter `name`: Name for the trigger.
///
///
/// Parameter `fireDate`: The initial fire date for the timer trigger. The seconds value must be zero.
/// Date should be at least 1 minute ahead for reliable firing.
/// HMErrorCodeDateMustBeOnSpecifiedBoundaries will be returned when adding the trigger
/// to a home if the fireDate includes a seconds value other than 0.
///
///
/// Parameter `recurrence`: The recurrence interval to fire the trigger. A value of nil indicates that the
/// trigger is non-repeating. The minimum reccurence interval is 5 minutes, maximum
/// recurrence interval is 5 weeks and the recurrence interval must be specified in
/// multiples of whole minutes.
///
///
/// Validity checks are performed when the trigger is added to the home and the NSError in
/// the completion block for addTrigger: method indicates the reason for the failure:
/// HMErrorCodeDateMustBeOnSpecifiedBoundaries is returned if the seconds/nanoseconds fields
/// in recurrence interval or seconds field in fireDate have a value other than 0.
/// HMErrorCodeRecurrenceTooSmall is returned if recurrence interval is less than 5 minutes.
/// HMErrorCodeRecurrenceTooLarge is returned if recurrence interval is greater than 5 weeks.
/// HMErrorCodeFireDateInPast is returned if recurrence is nil and fireDate is in the past.
#[unsafe(method(initWithName:fireDate:recurrence:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithName_fireDate_recurrence(
this: Allocated<Self>,
name: &NSString,
fire_date: &NSDate,
recurrence: Option<&NSDateComponents>,
) -> Retained<Self>;
#[deprecated]
#[unsafe(method(initWithName:fireDate:timeZone:recurrence:recurrenceCalendar:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithName_fireDate_timeZone_recurrence_recurrenceCalendar(
this: Allocated<Self>,
name: &NSString,
fire_date: &NSDate,
time_zone: Option<&NSTimeZone>,
recurrence: Option<&NSDateComponents>,
recurrence_calendar: Option<&NSCalendar>,
) -> Retained<Self>;
/// Specifies when, in an absolute time, the trigger should fire the first time.
///
///
/// Timer triggers are only set at the top of the minute. When the timer trigger fires,
/// it will typically fire within 1 minute of the scheduled fire date or calculated
/// recurrence fire date, depending on how the system is managing its resources.
///
///
/// Note: Should be at least 1 minute ahead for reliable firing.
///
/// This property is not atomic.
///
/// # Safety
///
/// This might not be thread-safe.
#[unsafe(method(fireDate))]
#[unsafe(method_family = none)]
pub unsafe fn fireDate(&self) -> Retained<NSDate>;
/// This property is not atomic.
///
/// # Safety
///
/// This might not be thread-safe.
#[deprecated = "Use HMEventTrigger with HMCalendarEvent for triggers based on a time-zone-relative time of day"]
#[unsafe(method(timeZone))]
#[unsafe(method_family = none)]
pub unsafe fn timeZone(&self) -> Option<Retained<NSTimeZone>>;
/// The date components that specify how a trigger is to be repeated.
///
///
/// This value must be nil if the trigger should not repeat. The date component
/// values are relative to the initial fire date of the trigger. If the
/// calendar value of the recurrence is nil, the current calendar
/// will be used to calculate the recurrence interval. Recurrence example: if a
/// trigger should repeat every hour, set the 'hour' property of the
/// recurrence to 1. The minimum recurrence interval is 5 minutes, maximum recurrence
/// interval is 5 weeks and the recurrence interval must be specified in multiples of
/// whole minutes. Examples are 5 minutes, 6 minutes, 1 day, 2 weeks.
///
/// This property is not atomic.
///
/// # Safety
///
/// This might not be thread-safe.
#[unsafe(method(recurrence))]
#[unsafe(method_family = none)]
pub unsafe fn recurrence(&self) -> Option<Retained<NSDateComponents>>;
/// This property is not atomic.
///
/// # Safety
///
/// This might not be thread-safe.
#[deprecated = "No longer supported"]
#[unsafe(method(recurrenceCalendar))]
#[unsafe(method_family = none)]
pub unsafe fn recurrenceCalendar(&self) -> Option<Retained<NSCalendar>>;
#[cfg(feature = "block2")]
/// This method is used to change the fire date of a timer trigger.
///
///
/// Parameter `fireDate`: New fire date for the trigger. The seconds value must be zero.
///
///
/// Parameter `completion`: Block that is invoked once the request is processed.
/// The NSError provides more information on the status of the request,
/// error will be nil on success. HMErrorCodeDateMustBeOnSpecifiedBoundaries will
/// be returned if the fireDate includes a seconds value other than 0.
#[unsafe(method(updateFireDate:completionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn updateFireDate_completionHandler(
&self,
fire_date: &NSDate,
completion: &block2::DynBlock<dyn Fn(*mut NSError)>,
);
#[cfg(feature = "block2")]
#[deprecated = "Use HMEventTrigger with HMCalendarEvent for triggers based on a time-zone-relative time of day"]
#[unsafe(method(updateTimeZone:completionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn updateTimeZone_completionHandler(
&self,
time_zone: Option<&NSTimeZone>,
completion: &block2::DynBlock<dyn Fn(*mut NSError)>,
);
#[cfg(feature = "block2")]
/// This method is used to change the recurrence interval for a timer trigger.
///
///
/// Parameter `recurrence`: New recurrence interval for the trigger. Passing a nil indicates that
/// the trigger is non-repeating. The minimum recurrence interval is 5 minutes,
/// maximum recurrence interval is 5 weeks and the recurrence interval must be specified
/// in multiples of whole minutes.
///
///
/// Parameter `completion`: Block that is invoked once the request is processed.
/// The NSError provides more information on the status of the request:
/// HMErrorCodeDateMustBeOnSpecifiedBoundaries is returned if the seconds/nanoseconds
/// fields have a value other than 0;
/// HMErrorCodeRecurrenceTooSmall is returned if the recurrence interval is less than
/// 5 minutes;
/// HMErrorCodeRecurrenceTooLarge is returned if the recurrence interval is
/// greater than 5 weeks. * error will be nil on success.
#[unsafe(method(updateRecurrence:completionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn updateRecurrence_completionHandler(
&self,
recurrence: Option<&NSDateComponents>,
completion: &block2::DynBlock<dyn Fn(*mut NSError)>,
);
);
}
/// Methods declared on superclass `NSObject`.
#[cfg(feature = "HMTrigger")]
impl HMTimerTrigger {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}