objc2_home_kit/generated/HMZone.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 /// Used to describe a collection of HMRoom objects
12 ///
13 ///
14 /// This class is used to group a collection of rooms.
15 /// This allows for association of a set of rooms into a group.
16 /// Eg. "Living Room" and "Kitchen" rooms can be grouped together
17 /// in the "Downstairs" zone.
18 ///
19 /// See also [Apple's documentation](https://developer.apple.com/documentation/homekit/hmzone?language=objc)
20 #[unsafe(super(NSObject))]
21 #[derive(Debug, PartialEq, Eq, Hash)]
22 pub struct HMZone;
23);
24
25unsafe impl Send for HMZone {}
26
27unsafe impl Sync for HMZone {}
28
29extern_conformance!(
30 unsafe impl NSObjectProtocol for HMZone {}
31);
32
33impl HMZone {
34 extern_methods!(
35 #[unsafe(method(init))]
36 #[unsafe(method_family = init)]
37 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
38
39 /// Name of the zone.
40 ///
41 /// This property is not atomic.
42 ///
43 /// # Safety
44 ///
45 /// This might not be thread-safe.
46 #[unsafe(method(name))]
47 #[unsafe(method_family = none)]
48 pub unsafe fn name(&self) -> Retained<NSString>;
49
50 #[cfg(feature = "HMRoom")]
51 /// Array of HMRoom objects that correspond to the rooms contained in this zone.
52 ///
53 /// This property is not atomic.
54 ///
55 /// # Safety
56 ///
57 /// This might not be thread-safe.
58 #[unsafe(method(rooms))]
59 #[unsafe(method_family = none)]
60 pub unsafe fn rooms(&self) -> Retained<NSArray<HMRoom>>;
61
62 /// A unique identifier for the zone.
63 ///
64 /// This property is not atomic.
65 ///
66 /// # Safety
67 ///
68 /// This might not be thread-safe.
69 #[unsafe(method(uniqueIdentifier))]
70 #[unsafe(method_family = none)]
71 pub unsafe fn uniqueIdentifier(&self) -> Retained<NSUUID>;
72
73 #[cfg(feature = "block2")]
74 /// This method is used to change the name of the zone.
75 ///
76 ///
77 /// Parameter `name`: New name for the zone.
78 ///
79 ///
80 /// Parameter `completion`: Block that is invoked once the request is processed.
81 /// The NSError provides more information on the status of the request, error
82 /// will be nil on success.
83 #[unsafe(method(updateName:completionHandler:))]
84 #[unsafe(method_family = none)]
85 pub unsafe fn updateName_completionHandler(
86 &self,
87 name: &NSString,
88 completion: &block2::DynBlock<dyn Fn(*mut NSError)>,
89 );
90
91 #[cfg(all(feature = "HMRoom", feature = "block2"))]
92 /// Adds a room to a zone.
93 ///
94 ///
95 /// Both the room and the zone should be part of the home. A room can be added to multiple
96 /// zones, e.g., a room "Kitchen" can be added to "Downstairs" as well as "Outdoor" zones.
97 ///
98 ///
99 /// Parameter `room`: Room to add to this zone.
100 ///
101 ///
102 /// Parameter `completion`: Block that is invoked once the request is processed.
103 /// The NSError provides more information on the status of the request, error
104 /// will be nil on success.
105 #[unsafe(method(addRoom:completionHandler:))]
106 #[unsafe(method_family = none)]
107 pub unsafe fn addRoom_completionHandler(
108 &self,
109 room: &HMRoom,
110 completion: &block2::DynBlock<dyn Fn(*mut NSError)>,
111 );
112
113 #[cfg(all(feature = "HMRoom", feature = "block2"))]
114 /// Removes a room from the zone.
115 ///
116 ///
117 /// Parameter `room`: Room to remove from this zone.
118 ///
119 ///
120 /// Parameter `completion`: Block that is invoked once the request is processed.
121 /// The NSError provides more information on the status of the request, error
122 /// will be nil on success.
123 #[unsafe(method(removeRoom:completionHandler:))]
124 #[unsafe(method_family = none)]
125 pub unsafe fn removeRoom_completionHandler(
126 &self,
127 room: &HMRoom,
128 completion: &block2::DynBlock<dyn Fn(*mut NSError)>,
129 );
130 );
131}
132
133/// Methods declared on superclass `NSObject`.
134impl HMZone {
135 extern_methods!(
136 #[unsafe(method(new))]
137 #[unsafe(method_family = new)]
138 pub unsafe fn new() -> Retained<Self>;
139 );
140}