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