objc2_home_kit/generated/HMActionSet.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 a collection of action objects that can be executed.
12 /// The order of execution of these actions is undefined.
13 ///
14 /// See also [Apple's documentation](https://developer.apple.com/documentation/homekit/hmactionset?language=objc)
15 #[unsafe(super(NSObject))]
16 #[derive(Debug, PartialEq, Eq, Hash)]
17 pub struct HMActionSet;
18);
19
20unsafe impl Send for HMActionSet {}
21
22unsafe impl Sync for HMActionSet {}
23
24extern_conformance!(
25 unsafe impl NSObjectProtocol for HMActionSet {}
26);
27
28impl HMActionSet {
29 extern_methods!(
30 #[unsafe(method(init))]
31 #[unsafe(method_family = init)]
32 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
33
34 /// The name of the action set.
35 ///
36 /// This property is not atomic.
37 ///
38 /// # Safety
39 ///
40 /// This might not be thread-safe.
41 #[unsafe(method(name))]
42 #[unsafe(method_family = none)]
43 pub unsafe fn name(&self) -> Retained<NSString>;
44
45 #[cfg(feature = "HMAction")]
46 /// Set of HMAction objects that represent the individual items of the action set.
47 ///
48 /// This property is not atomic.
49 ///
50 /// # Safety
51 ///
52 /// This might not be thread-safe.
53 #[unsafe(method(actions))]
54 #[unsafe(method_family = none)]
55 pub unsafe fn actions(&self) -> Retained<NSSet<HMAction>>;
56
57 /// Specifies whether the action set is currently executing or not.
58 ///
59 /// This property is not atomic.
60 ///
61 /// # Safety
62 ///
63 /// This might not be thread-safe.
64 #[unsafe(method(isExecuting))]
65 #[unsafe(method_family = none)]
66 pub unsafe fn isExecuting(&self) -> bool;
67
68 /// Specifies the action set type - user-defined, trigger-owned or one of the builtin types.
69 /// Builtin action sets cannot be removed from the home. trigger-owned action sets cannot
70 /// be executed, renamed or associated with another trigger.
71 ///
72 /// This property is not atomic.
73 ///
74 /// # Safety
75 ///
76 /// This might not be thread-safe.
77 #[unsafe(method(actionSetType))]
78 #[unsafe(method_family = none)]
79 pub unsafe fn actionSetType(&self) -> Retained<NSString>;
80
81 /// A unique identifier for the action set.
82 ///
83 /// This property is not atomic.
84 ///
85 /// # Safety
86 ///
87 /// This might not be thread-safe.
88 #[unsafe(method(uniqueIdentifier))]
89 #[unsafe(method_family = none)]
90 pub unsafe fn uniqueIdentifier(&self) -> Retained<NSUUID>;
91
92 /// Specifies the last execution date for the action set.
93 ///
94 /// This property is not atomic.
95 ///
96 /// # Safety
97 ///
98 /// This might not be thread-safe.
99 #[unsafe(method(lastExecutionDate))]
100 #[unsafe(method_family = none)]
101 pub unsafe fn lastExecutionDate(&self) -> Option<Retained<NSDate>>;
102
103 #[cfg(all(feature = "HMDefines", feature = "block2"))]
104 /// This method is used to change the name of the action set.
105 ///
106 ///
107 /// Parameter `name`: New name for the action set.
108 ///
109 ///
110 /// Parameter `completion`: Block that is invoked once the request is processed.
111 /// The NSError provides more information on the status of the request, error
112 /// will be nil on success.
113 ///
114 /// # Safety
115 ///
116 /// `completion` must be a valid pointer.
117 #[unsafe(method(updateName:completionHandler:))]
118 #[unsafe(method_family = none)]
119 pub unsafe fn updateName_completionHandler(
120 &self,
121 name: &NSString,
122 completion: HMErrorBlock,
123 );
124
125 #[cfg(all(feature = "HMAction", feature = "HMDefines", feature = "block2"))]
126 /// Adds an action to the action set.
127 ///
128 ///
129 /// Parameter `action`: Action object to add to the action set.
130 ///
131 ///
132 /// Parameter `completion`: Block that is invoked once the request is processed.
133 /// The NSError provides more information on the status of the request, error
134 /// will be nil on success.
135 ///
136 /// # Safety
137 ///
138 /// `completion` must be a valid pointer.
139 #[unsafe(method(addAction:completionHandler:))]
140 #[unsafe(method_family = none)]
141 pub unsafe fn addAction_completionHandler(
142 &self,
143 action: &HMAction,
144 completion: HMErrorBlock,
145 );
146
147 #[cfg(all(feature = "HMAction", feature = "HMDefines", feature = "block2"))]
148 /// Removes an existing action from the action set.
149 ///
150 ///
151 /// Parameter `action`: Action object to remove from the action set.
152 ///
153 ///
154 /// Parameter `completion`: Block that is invoked once the request is processed.
155 /// The NSError provides more information on the status of the request, error
156 /// will be nil on success.
157 ///
158 /// # Safety
159 ///
160 /// `completion` must be a valid pointer.
161 #[unsafe(method(removeAction:completionHandler:))]
162 #[unsafe(method_family = none)]
163 pub unsafe fn removeAction_completionHandler(
164 &self,
165 action: &HMAction,
166 completion: HMErrorBlock,
167 );
168 );
169}
170
171/// Methods declared on superclass `NSObject`.
172impl HMActionSet {
173 extern_methods!(
174 #[unsafe(method(new))]
175 #[unsafe(method_family = new)]
176 pub unsafe fn new() -> Retained<Self>;
177 );
178}
179
180extern "C" {
181 /// Builtin action set type for WakeUp.
182 ///
183 /// See also [Apple's documentation](https://developer.apple.com/documentation/homekit/hmactionsettypewakeup?language=objc)
184 pub static HMActionSetTypeWakeUp: &'static NSString;
185}
186
187extern "C" {
188 /// Type for builtin action set Sleep.
189 ///
190 /// See also [Apple's documentation](https://developer.apple.com/documentation/homekit/hmactionsettypesleep?language=objc)
191 pub static HMActionSetTypeSleep: &'static NSString;
192}
193
194extern "C" {
195 /// Type for builtin action set HomeDeparture.
196 ///
197 /// See also [Apple's documentation](https://developer.apple.com/documentation/homekit/hmactionsettypehomedeparture?language=objc)
198 pub static HMActionSetTypeHomeDeparture: &'static NSString;
199}
200
201extern "C" {
202 /// Type for builtin action set HomeArrival.
203 ///
204 /// See also [Apple's documentation](https://developer.apple.com/documentation/homekit/hmactionsettypehomearrival?language=objc)
205 pub static HMActionSetTypeHomeArrival: &'static NSString;
206}
207
208extern "C" {
209 /// Type for user-defined action sets.
210 ///
211 /// See also [Apple's documentation](https://developer.apple.com/documentation/homekit/hmactionsettypeuserdefined?language=objc)
212 pub static HMActionSetTypeUserDefined: &'static NSString;
213}
214
215extern "C" {
216 /// Type for trigger-owned action sets.
217 ///
218 ///
219 /// An action set of this type is owned by a trigger and is not listed
220 /// as part of the home. An action set of this type cannot be executed,
221 /// renamed, or associated with a different trigger.
222 ///
223 /// See also [Apple's documentation](https://developer.apple.com/documentation/homekit/hmactionsettypetriggerowned?language=objc)
224 pub static HMActionSetTypeTriggerOwned: &'static NSString;
225}