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