objc2_home_kit/generated/
HMLocationEvent.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::*;
6#[cfg(feature = "objc2-core-location")]
7use objc2_core_location::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12extern_class!(
13    /// This class represents an event that is evaluated based on entry to and/or
14    /// exit from a Region
15    ///
16    /// See also [Apple's documentation](https://developer.apple.com/documentation/homekit/hmlocationevent?language=objc)
17    #[unsafe(super(HMEvent, NSObject))]
18    #[derive(Debug, PartialEq, Eq, Hash)]
19    #[cfg(feature = "HMEvent")]
20    pub struct HMLocationEvent;
21);
22
23#[cfg(feature = "HMEvent")]
24unsafe impl Send for HMLocationEvent {}
25
26#[cfg(feature = "HMEvent")]
27unsafe impl Sync for HMLocationEvent {}
28
29#[cfg(feature = "HMEvent")]
30extern_conformance!(
31    unsafe impl NSCopying for HMLocationEvent {}
32);
33
34#[cfg(feature = "HMEvent")]
35unsafe impl CopyingHelper for HMLocationEvent {
36    type Result = Self;
37}
38
39#[cfg(feature = "HMEvent")]
40extern_conformance!(
41    unsafe impl NSMutableCopying for HMLocationEvent {}
42);
43
44#[cfg(feature = "HMEvent")]
45unsafe impl MutableCopyingHelper for HMLocationEvent {
46    type Result = HMMutableLocationEvent;
47}
48
49#[cfg(feature = "HMEvent")]
50extern_conformance!(
51    unsafe impl NSObjectProtocol for HMLocationEvent {}
52);
53
54#[cfg(feature = "HMEvent")]
55impl HMLocationEvent {
56    extern_methods!(
57        #[unsafe(method(init))]
58        #[unsafe(method_family = init)]
59        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
60
61        #[cfg(feature = "objc2-core-location")]
62        /// Initializes a new location event object
63        ///
64        ///
65        /// Parameter `region`: - Region with at least one property of notifyOnEntry or notifyOnExit set to TRUE.
66        ///
67        ///
68        /// Returns: Instance object representing the location event.
69        #[unsafe(method(initWithRegion:))]
70        #[unsafe(method_family = init)]
71        pub unsafe fn initWithRegion(this: Allocated<Self>, region: &CLRegion) -> Retained<Self>;
72
73        #[cfg(feature = "objc2-core-location")]
74        /// Region on which events are triggered based on the properties notifyOnEntry and notifyOnExit.
75        /// This property will be nil when an application is not authorized for location services.
76        ///
77        /// This property is not atomic.
78        ///
79        /// # Safety
80        ///
81        /// This might not be thread-safe.
82        #[unsafe(method(region))]
83        #[unsafe(method_family = none)]
84        pub unsafe fn region(&self) -> Option<Retained<CLRegion>>;
85
86        #[cfg(all(feature = "block2", feature = "objc2-core-location"))]
87        /// Updates the region
88        ///
89        ///
90        /// Parameter `region`: - New region with at least one property of notifyOnEntry or notifyOnExit set to TRUE.
91        ///
92        ///
93        /// Parameter `completion`: Block that is invoked once the request is processed.
94        /// The NSError provides more information on the status of the request, error
95        /// will be nil on success.
96        #[deprecated = "No longer supported."]
97        #[unsafe(method(updateRegion:completionHandler:))]
98        #[unsafe(method_family = none)]
99        pub unsafe fn updateRegion_completionHandler(
100            &self,
101            region: &CLRegion,
102            completion: &block2::DynBlock<dyn Fn(*mut NSError)>,
103        );
104    );
105}
106
107/// Methods declared on superclass `HMEvent`.
108#[cfg(feature = "HMEvent")]
109impl HMLocationEvent {
110    extern_methods!(
111        #[deprecated = "HMEvent is abstract"]
112        #[unsafe(method(new))]
113        #[unsafe(method_family = new)]
114        pub unsafe fn new() -> Retained<Self>;
115    );
116}
117
118extern_class!(
119    /// This class represents an event that is evaluated based on entry to and/or
120    /// exit from a Region
121    ///
122    /// See also [Apple's documentation](https://developer.apple.com/documentation/homekit/hmmutablelocationevent?language=objc)
123    #[unsafe(super(HMLocationEvent, HMEvent, NSObject))]
124    #[derive(Debug, PartialEq, Eq, Hash)]
125    #[cfg(feature = "HMEvent")]
126    pub struct HMMutableLocationEvent;
127);
128
129#[cfg(feature = "HMEvent")]
130unsafe impl Send for HMMutableLocationEvent {}
131
132#[cfg(feature = "HMEvent")]
133unsafe impl Sync for HMMutableLocationEvent {}
134
135#[cfg(feature = "HMEvent")]
136extern_conformance!(
137    unsafe impl NSCopying for HMMutableLocationEvent {}
138);
139
140#[cfg(feature = "HMEvent")]
141unsafe impl CopyingHelper for HMMutableLocationEvent {
142    type Result = HMLocationEvent;
143}
144
145#[cfg(feature = "HMEvent")]
146extern_conformance!(
147    unsafe impl NSMutableCopying for HMMutableLocationEvent {}
148);
149
150#[cfg(feature = "HMEvent")]
151unsafe impl MutableCopyingHelper for HMMutableLocationEvent {
152    type Result = Self;
153}
154
155#[cfg(feature = "HMEvent")]
156extern_conformance!(
157    unsafe impl NSObjectProtocol for HMMutableLocationEvent {}
158);
159
160#[cfg(feature = "HMEvent")]
161impl HMMutableLocationEvent {
162    extern_methods!(
163        #[unsafe(method(init))]
164        #[unsafe(method_family = init)]
165        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
166
167        #[cfg(feature = "objc2-core-location")]
168        /// Region on which events are triggered based on the properties notifyOnEntry and notifyOnExit.
169        /// This property will be nil when an application is not authorized for location services.
170        ///
171        /// This property is not atomic.
172        ///
173        /// # Safety
174        ///
175        /// This might not be thread-safe.
176        #[unsafe(method(region))]
177        #[unsafe(method_family = none)]
178        pub unsafe fn region(&self) -> Option<Retained<CLRegion>>;
179
180        #[cfg(feature = "objc2-core-location")]
181        /// Setter for [`region`][Self::region].
182        ///
183        /// # Safety
184        ///
185        /// This might not be thread-safe.
186        #[unsafe(method(setRegion:))]
187        #[unsafe(method_family = none)]
188        pub unsafe fn setRegion(&self, region: Option<&CLRegion>);
189    );
190}
191
192/// Methods declared on superclass `HMLocationEvent`.
193#[cfg(feature = "HMEvent")]
194impl HMMutableLocationEvent {
195    extern_methods!(
196        #[cfg(feature = "objc2-core-location")]
197        /// Initializes a new location event object
198        ///
199        ///
200        /// Parameter `region`: - Region with at least one property of notifyOnEntry or notifyOnExit set to TRUE.
201        ///
202        ///
203        /// Returns: Instance object representing the location event.
204        #[unsafe(method(initWithRegion:))]
205        #[unsafe(method_family = init)]
206        pub unsafe fn initWithRegion(this: Allocated<Self>, region: &CLRegion) -> Retained<Self>;
207    );
208}
209
210/// Methods declared on superclass `HMEvent`.
211#[cfg(feature = "HMEvent")]
212impl HMMutableLocationEvent {
213    extern_methods!(
214        #[deprecated = "HMEvent is abstract"]
215        #[unsafe(method(new))]
216        #[unsafe(method_family = new)]
217        pub unsafe fn new() -> Retained<Self>;
218    );
219}