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 #[unsafe(method(name))]
41 #[unsafe(method_family = none)]
42 pub unsafe fn name(&self) -> Retained<NSString>;
43
44 #[cfg(feature = "HMRoom")]
45 /// Array of HMRoom objects that correspond to the rooms contained in this zone.
46 #[unsafe(method(rooms))]
47 #[unsafe(method_family = none)]
48 pub unsafe fn rooms(&self) -> Retained<NSArray<HMRoom>>;
49
50 /// A unique identifier for the zone.
51 #[unsafe(method(uniqueIdentifier))]
52 #[unsafe(method_family = none)]
53 pub unsafe fn uniqueIdentifier(&self) -> Retained<NSUUID>;
54
55 #[cfg(feature = "block2")]
56 /// This method is used to change the name of the zone.
57 ///
58 ///
59 /// Parameter `name`: New name for the zone.
60 ///
61 ///
62 /// Parameter `completion`: Block that is invoked once the request is processed.
63 /// The NSError provides more information on the status of the request, error
64 /// will be nil on success.
65 #[unsafe(method(updateName:completionHandler:))]
66 #[unsafe(method_family = none)]
67 pub unsafe fn updateName_completionHandler(
68 &self,
69 name: &NSString,
70 completion: &block2::DynBlock<dyn Fn(*mut NSError)>,
71 );
72
73 #[cfg(all(feature = "HMRoom", feature = "block2"))]
74 /// Adds a room to a zone.
75 ///
76 ///
77 /// Both the room and the zone should be part of the home. A room can be added to multiple
78 /// zones, e.g., a room "Kitchen" can be added to "Downstairs" as well as "Outdoor" zones.
79 ///
80 ///
81 /// Parameter `room`: Room to add to this zone.
82 ///
83 ///
84 /// Parameter `completion`: Block that is invoked once the request is processed.
85 /// The NSError provides more information on the status of the request, error
86 /// will be nil on success.
87 #[unsafe(method(addRoom:completionHandler:))]
88 #[unsafe(method_family = none)]
89 pub unsafe fn addRoom_completionHandler(
90 &self,
91 room: &HMRoom,
92 completion: &block2::DynBlock<dyn Fn(*mut NSError)>,
93 );
94
95 #[cfg(all(feature = "HMRoom", feature = "block2"))]
96 /// Removes a room from the zone.
97 ///
98 ///
99 /// Parameter `room`: Room to remove from 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(removeRoom:completionHandler:))]
106 #[unsafe(method_family = none)]
107 pub unsafe fn removeRoom_completionHandler(
108 &self,
109 room: &HMRoom,
110 completion: &block2::DynBlock<dyn Fn(*mut NSError)>,
111 );
112 );
113}
114
115/// Methods declared on superclass `NSObject`.
116impl HMZone {
117 extern_methods!(
118 #[unsafe(method(new))]
119 #[unsafe(method_family = new)]
120 pub unsafe fn new() -> Retained<Self>;
121 );
122}