objc2_accessory_setup_kit/generated/ASPickerDisplayItem.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#[cfg(feature = "objc2-ui-kit")]
8use objc2_ui_kit::*;
9
10use crate::*;
11
12/// Accessory Setup Options
13///
14/// See also [Apple's documentation](https://developer.apple.com/documentation/accessorysetupkit/aspickerdisplayitemsetupoptions?language=objc)
15// NS_OPTIONS
16#[repr(transparent)]
17#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
18pub struct ASPickerDisplayItemSetupOptions(pub NSUInteger);
19bitflags::bitflags! {
20 impl ASPickerDisplayItemSetupOptions: NSUInteger {
21/// An option to ask the person using the app to rename the accessory.
22 #[doc(alias = "ASPickerDisplayItemSetupRename")]
23 const Rename = 1<<0;
24/// An option to require the app to finish accessory authorization before showing the setup view.
25///
26/// If the accessory supports ``ASAccessory/SupportOptions/bluetoothPairingLE``, then the app needs to start pairing by accessing a protected GATT characteristic.
27 #[doc(alias = "ASPickerDisplayItemSetupConfirmAuthorization")]
28 const ConfirmAuthorization = 1<<1;
29/// An option to ask the person setting up the accessory to finish additional setup in the app after the accessory is authorized.
30 #[doc(alias = "ASPickerDisplayItemSetupFinishInApp")]
31 const FinishInApp = 1<<2;
32 }
33}
34
35unsafe impl Encode for ASPickerDisplayItemSetupOptions {
36 const ENCODING: Encoding = NSUInteger::ENCODING;
37}
38
39unsafe impl RefEncode for ASPickerDisplayItemSetupOptions {
40 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
41}
42
43extern_class!(
44 /// [Apple's documentation](https://developer.apple.com/documentation/accessorysetupkit/aspickerdisplayitem?language=objc)
45 #[unsafe(super(NSObject))]
46 #[derive(Debug, PartialEq, Eq, Hash)]
47 pub struct ASPickerDisplayItem;
48);
49
50unsafe impl Send for ASPickerDisplayItem {}
51
52unsafe impl Sync for ASPickerDisplayItem {}
53
54extern_conformance!(
55 unsafe impl NSObjectProtocol for ASPickerDisplayItem {}
56);
57
58impl ASPickerDisplayItem {
59 extern_methods!(
60 /// The accessory name to display in the picker.
61 ///
62 /// This property is not atomic.
63 ///
64 /// # Safety
65 ///
66 /// This might not be thread-safe.
67 #[unsafe(method(name))]
68 #[unsafe(method_family = none)]
69 pub unsafe fn name(&self) -> Retained<NSString>;
70
71 #[cfg(feature = "objc2-ui-kit")]
72 /// An image of the accessory to display in the picker.
73 ///
74 /// This property is not atomic.
75 ///
76 /// # Safety
77 ///
78 /// This might not be thread-safe.
79 #[unsafe(method(productImage))]
80 #[unsafe(method_family = none)]
81 pub unsafe fn productImage(&self) -> Retained<UIImage>;
82
83 #[cfg(feature = "ASDiscoveryDescriptor")]
84 /// A descriptor that the picker uses to determine which discovered accessories to display.
85 ///
86 /// This property is not atomic.
87 ///
88 /// # Safety
89 ///
90 /// This might not be thread-safe.
91 #[unsafe(method(descriptor))]
92 #[unsafe(method_family = none)]
93 pub unsafe fn descriptor(&self) -> Retained<ASDiscoveryDescriptor>;
94
95 #[cfg(feature = "ASAccessory")]
96 /// Options to allow renaming a matched accessory.
97 ///
98 /// To permit renaming, include ``SetupOptions-swift.struct/rename`` in the ``setupOptions-c.property``
99 ///
100 /// This property is not atomic.
101 ///
102 /// # Safety
103 ///
104 /// This might not be thread-safe.
105 #[unsafe(method(renameOptions))]
106 #[unsafe(method_family = none)]
107 pub unsafe fn renameOptions(&self) -> ASAccessoryRenameOptions;
108
109 #[cfg(feature = "ASAccessory")]
110 /// Setter for [`renameOptions`][Self::renameOptions].
111 ///
112 /// # Safety
113 ///
114 /// This might not be thread-safe.
115 #[unsafe(method(setRenameOptions:))]
116 #[unsafe(method_family = none)]
117 pub unsafe fn setRenameOptions(&self, rename_options: ASAccessoryRenameOptions);
118
119 /// Custom setup options for the accessory.
120 ///
121 /// This property is not atomic.
122 ///
123 /// # Safety
124 ///
125 /// This might not be thread-safe.
126 #[unsafe(method(setupOptions))]
127 #[unsafe(method_family = none)]
128 pub unsafe fn setupOptions(&self) -> ASPickerDisplayItemSetupOptions;
129
130 /// Setter for [`setupOptions`][Self::setupOptions].
131 ///
132 /// # Safety
133 ///
134 /// This might not be thread-safe.
135 #[unsafe(method(setSetupOptions:))]
136 #[unsafe(method_family = none)]
137 pub unsafe fn setSetupOptions(&self, setup_options: ASPickerDisplayItemSetupOptions);
138
139 #[cfg(all(feature = "ASDiscoveryDescriptor", feature = "objc2-ui-kit"))]
140 /// Creates a picker display item with a name and image to display and a descriptor to match discovered accessories.
141 /// - Parameters:
142 /// - name: The accessory name to display in the picker.
143 /// - productImage: An image of the accessory to display in the picker.
144 /// - descriptor: A descriptor that the picker uses to determine which discovered accessories to display.
145 #[unsafe(method(initWithName:productImage:descriptor:))]
146 #[unsafe(method_family = init)]
147 pub unsafe fn initWithName_productImage_descriptor(
148 this: Allocated<Self>,
149 name: &NSString,
150 product_image: &UIImage,
151 descriptor: &ASDiscoveryDescriptor,
152 ) -> Retained<Self>;
153
154 #[unsafe(method(init))]
155 #[unsafe(method_family = init)]
156 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
157
158 #[unsafe(method(new))]
159 #[unsafe(method_family = new)]
160 pub unsafe fn new(&self) -> Retained<Self>;
161 );
162}
163
164/// Methods declared on superclass `NSObject`.
165impl ASPickerDisplayItem {
166 extern_methods!(
167 #[unsafe(method(new))]
168 #[unsafe(method_family = new)]
169 pub unsafe fn new_class() -> Retained<Self>;
170 );
171}
172
173extern_class!(
174 /// [Apple's documentation](https://developer.apple.com/documentation/accessorysetupkit/asmigrationdisplayitem?language=objc)
175 #[unsafe(super(ASPickerDisplayItem, NSObject))]
176 #[derive(Debug, PartialEq, Eq, Hash)]
177 pub struct ASMigrationDisplayItem;
178);
179
180unsafe impl Send for ASMigrationDisplayItem {}
181
182unsafe impl Sync for ASMigrationDisplayItem {}
183
184extern_conformance!(
185 unsafe impl NSObjectProtocol for ASMigrationDisplayItem {}
186);
187
188impl ASMigrationDisplayItem {
189 extern_methods!(
190 /// The Bluetooth identifier of the accessory to migrate.
191 ///
192 /// This property is not atomic.
193 ///
194 /// # Safety
195 ///
196 /// This might not be thread-safe.
197 #[unsafe(method(peripheralIdentifier))]
198 #[unsafe(method_family = none)]
199 pub unsafe fn peripheralIdentifier(&self) -> Option<Retained<NSUUID>>;
200
201 /// Setter for [`peripheralIdentifier`][Self::peripheralIdentifier].
202 ///
203 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
204 ///
205 /// # Safety
206 ///
207 /// This might not be thread-safe.
208 #[unsafe(method(setPeripheralIdentifier:))]
209 #[unsafe(method_family = none)]
210 pub unsafe fn setPeripheralIdentifier(&self, peripheral_identifier: Option<&NSUUID>);
211
212 /// The Wi-Fi hotspot SSID of the accessory to migrate.
213 ///
214 /// This property is not atomic.
215 ///
216 /// # Safety
217 ///
218 /// This might not be thread-safe.
219 #[unsafe(method(hotspotSSID))]
220 #[unsafe(method_family = none)]
221 pub unsafe fn hotspotSSID(&self) -> Option<Retained<NSString>>;
222
223 /// Setter for [`hotspotSSID`][Self::hotspotSSID].
224 ///
225 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
226 ///
227 /// # Safety
228 ///
229 /// This might not be thread-safe.
230 #[unsafe(method(setHotspotSSID:))]
231 #[unsafe(method_family = none)]
232 pub unsafe fn setHotspotSSID(&self, hotspot_ssid: Option<&NSString>);
233 );
234}
235
236/// Methods declared on superclass `ASPickerDisplayItem`.
237impl ASMigrationDisplayItem {
238 extern_methods!(
239 #[cfg(all(feature = "ASDiscoveryDescriptor", feature = "objc2-ui-kit"))]
240 /// Creates a picker display item with a name and image to display and a descriptor to match discovered accessories.
241 /// - Parameters:
242 /// - name: The accessory name to display in the picker.
243 /// - productImage: An image of the accessory to display in the picker.
244 /// - descriptor: A descriptor that the picker uses to determine which discovered accessories to display.
245 #[unsafe(method(initWithName:productImage:descriptor:))]
246 #[unsafe(method_family = init)]
247 pub unsafe fn initWithName_productImage_descriptor(
248 this: Allocated<Self>,
249 name: &NSString,
250 product_image: &UIImage,
251 descriptor: &ASDiscoveryDescriptor,
252 ) -> Retained<Self>;
253
254 #[unsafe(method(init))]
255 #[unsafe(method_family = init)]
256 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
257 );
258}
259
260/// Methods declared on superclass `NSObject`.
261impl ASMigrationDisplayItem {
262 extern_methods!(
263 #[unsafe(method(new))]
264 #[unsafe(method_family = new)]
265 pub unsafe fn new() -> Retained<Self>;
266 );
267}