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