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