objc2_accessory_setup_kit/generated/
ASDiscoveryDescriptor.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::*;
6#[cfg(feature = "objc2-core-bluetooth")]
7use objc2_core_bluetooth::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12/// Discovery Range
13///
14/// See also [Apple's documentation](https://developer.apple.com/documentation/accessorysetupkit/asdiscoverydescriptorrange?language=objc)
15// NS_ENUM
16#[repr(transparent)]
17#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
18pub struct ASDiscoveryDescriptorRange(pub NSInteger);
19impl ASDiscoveryDescriptorRange {
20    /// The default range in which to discover accessories.
21    #[doc(alias = "ASDiscoveryDescriptorRangeDefault")]
22    pub const Default: Self = Self(0);
23    /// A range in the immediate vicinity of the device performing accessory discovery.
24    ///
25    /// This range means that an accessory is right next to the device running your app.
26    #[doc(alias = "ASDiscoveryDescriptorRangeImmediate")]
27    pub const Immediate: Self = Self(10);
28}
29
30unsafe impl Encode for ASDiscoveryDescriptorRange {
31    const ENCODING: Encoding = NSInteger::ENCODING;
32}
33
34unsafe impl RefEncode for ASDiscoveryDescriptorRange {
35    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
36}
37
38/// A type that defines service roles for Wi-Fi Aware accessories.
39///
40/// See also [Apple's documentation](https://developer.apple.com/documentation/accessorysetupkit/asdiscoverydescriptorwifiawareservicerole?language=objc)
41// NS_ENUM
42#[repr(transparent)]
43#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
44pub struct ASDiscoveryDescriptorWiFiAwareServiceRole(pub NSInteger);
45impl ASDiscoveryDescriptorWiFiAwareServiceRole {
46    /// The subscriber service role.
47    #[doc(alias = "ASDiscoveryDescriptorWiFiAwareServiceRoleSubscriber")]
48    pub const Subscriber: Self = Self(10);
49    /// The publisher service role.
50    #[doc(alias = "ASDiscoveryDescriptorWiFiAwareServiceRolePublisher")]
51    pub const Publisher: Self = Self(20);
52}
53
54unsafe impl Encode for ASDiscoveryDescriptorWiFiAwareServiceRole {
55    const ENCODING: Encoding = NSInteger::ENCODING;
56}
57
58unsafe impl RefEncode for ASDiscoveryDescriptorWiFiAwareServiceRole {
59    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
60}
61
62extern_class!(
63    /// [Apple's documentation](https://developer.apple.com/documentation/accessorysetupkit/asdiscoverydescriptor?language=objc)
64    #[unsafe(super(NSObject))]
65    #[derive(Debug, PartialEq, Eq, Hash)]
66    pub struct ASDiscoveryDescriptor;
67);
68
69unsafe impl Send for ASDiscoveryDescriptor {}
70
71unsafe impl Sync for ASDiscoveryDescriptor {}
72
73extern_conformance!(
74    unsafe impl NSObjectProtocol for ASDiscoveryDescriptor {}
75);
76
77impl ASDiscoveryDescriptor {
78    extern_methods!(
79        #[cfg(feature = "ASAccessory")]
80        /// Options supported by an accessory.
81        ///
82        /// This property is not atomic.
83        ///
84        /// # Safety
85        ///
86        /// This might not be thread-safe.
87        #[unsafe(method(supportedOptions))]
88        #[unsafe(method_family = none)]
89        pub unsafe fn supportedOptions(&self) -> ASAccessorySupportOptions;
90
91        #[cfg(feature = "ASAccessory")]
92        /// Setter for [`supportedOptions`][Self::supportedOptions].
93        ///
94        /// # Safety
95        ///
96        /// This might not be thread-safe.
97        #[unsafe(method(setSupportedOptions:))]
98        #[unsafe(method_family = none)]
99        pub unsafe fn setSupportedOptions(&self, supported_options: ASAccessorySupportOptions);
100
101        #[cfg(feature = "ASCommon")]
102        /// The accessory's 16-bit Bluetooth Company Identifier.
103        ///
104        /// This property is not atomic.
105        ///
106        /// # Safety
107        ///
108        /// This might not be thread-safe.
109        #[unsafe(method(bluetoothCompanyIdentifier))]
110        #[unsafe(method_family = none)]
111        pub unsafe fn bluetoothCompanyIdentifier(&self) -> ASBluetoothCompanyIdentifier;
112
113        #[cfg(feature = "ASCommon")]
114        /// Setter for [`bluetoothCompanyIdentifier`][Self::bluetoothCompanyIdentifier].
115        ///
116        /// # Safety
117        ///
118        /// This might not be thread-safe.
119        #[unsafe(method(setBluetoothCompanyIdentifier:))]
120        #[unsafe(method_family = none)]
121        pub unsafe fn setBluetoothCompanyIdentifier(
122            &self,
123            bluetooth_company_identifier: ASBluetoothCompanyIdentifier,
124        );
125
126        /// A byte buffer that matches the accessory's Bluetooth manufacturer data.
127        ///
128        /// This property is not atomic.
129        ///
130        /// # Safety
131        ///
132        /// This might not be thread-safe.
133        #[unsafe(method(bluetoothManufacturerDataBlob))]
134        #[unsafe(method_family = none)]
135        pub unsafe fn bluetoothManufacturerDataBlob(&self) -> Option<Retained<NSData>>;
136
137        /// Setter for [`bluetoothManufacturerDataBlob`][Self::bluetoothManufacturerDataBlob].
138        ///
139        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
140        ///
141        /// # Safety
142        ///
143        /// This might not be thread-safe.
144        #[unsafe(method(setBluetoothManufacturerDataBlob:))]
145        #[unsafe(method_family = none)]
146        pub unsafe fn setBluetoothManufacturerDataBlob(
147            &self,
148            bluetooth_manufacturer_data_blob: Option<&NSData>,
149        );
150
151        /// The accessory's Bluetooth manufacturer data mask.
152        ///
153        /// This property is not atomic.
154        ///
155        /// # Safety
156        ///
157        /// This might not be thread-safe.
158        #[unsafe(method(bluetoothManufacturerDataMask))]
159        #[unsafe(method_family = none)]
160        pub unsafe fn bluetoothManufacturerDataMask(&self) -> Option<Retained<NSData>>;
161
162        /// Setter for [`bluetoothManufacturerDataMask`][Self::bluetoothManufacturerDataMask].
163        ///
164        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
165        ///
166        /// # Safety
167        ///
168        /// This might not be thread-safe.
169        #[unsafe(method(setBluetoothManufacturerDataMask:))]
170        #[unsafe(method_family = none)]
171        pub unsafe fn setBluetoothManufacturerDataMask(
172            &self,
173            bluetooth_manufacturer_data_mask: Option<&NSData>,
174        );
175
176        /// The accessory's over-the-air Bluetooth name substring compare options.
177        ///
178        /// This property is not atomic.
179        ///
180        /// # Safety
181        ///
182        /// This might not be thread-safe.
183        #[unsafe(method(bluetoothNameSubstringCompareOptions))]
184        #[unsafe(method_family = none)]
185        pub unsafe fn bluetoothNameSubstringCompareOptions(&self) -> NSStringCompareOptions;
186
187        /// Setter for [`bluetoothNameSubstringCompareOptions`][Self::bluetoothNameSubstringCompareOptions].
188        ///
189        /// # Safety
190        ///
191        /// This might not be thread-safe.
192        #[unsafe(method(setBluetoothNameSubstringCompareOptions:))]
193        #[unsafe(method_family = none)]
194        pub unsafe fn setBluetoothNameSubstringCompareOptions(
195            &self,
196            bluetooth_name_substring_compare_options: NSStringCompareOptions,
197        );
198
199        /// The accessory's over-the-air Bluetooth name substring.
200        ///
201        /// This property is not atomic.
202        ///
203        /// # Safety
204        ///
205        /// This might not be thread-safe.
206        #[unsafe(method(bluetoothNameSubstring))]
207        #[unsafe(method_family = none)]
208        pub unsafe fn bluetoothNameSubstring(&self) -> Option<Retained<NSString>>;
209
210        /// Setter for [`bluetoothNameSubstring`][Self::bluetoothNameSubstring].
211        ///
212        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
213        ///
214        /// # Safety
215        ///
216        /// This might not be thread-safe.
217        #[unsafe(method(setBluetoothNameSubstring:))]
218        #[unsafe(method_family = none)]
219        pub unsafe fn setBluetoothNameSubstring(&self, bluetooth_name_substring: Option<&NSString>);
220
221        /// A property that tells the session to discover accessories within a specific Bluetooth range.
222        ///
223        /// This property is not atomic.
224        ///
225        /// # Safety
226        ///
227        /// This might not be thread-safe.
228        #[unsafe(method(bluetoothRange))]
229        #[unsafe(method_family = none)]
230        pub unsafe fn bluetoothRange(&self) -> ASDiscoveryDescriptorRange;
231
232        /// Setter for [`bluetoothRange`][Self::bluetoothRange].
233        ///
234        /// # Safety
235        ///
236        /// This might not be thread-safe.
237        #[unsafe(method(setBluetoothRange:))]
238        #[unsafe(method_family = none)]
239        pub unsafe fn setBluetoothRange(&self, bluetooth_range: ASDiscoveryDescriptorRange);
240
241        /// A byte buffer that matches the accessory's Bluetooth service data.
242        ///
243        /// This property is not atomic.
244        ///
245        /// # Safety
246        ///
247        /// This might not be thread-safe.
248        #[unsafe(method(bluetoothServiceDataBlob))]
249        #[unsafe(method_family = none)]
250        pub unsafe fn bluetoothServiceDataBlob(&self) -> Option<Retained<NSData>>;
251
252        /// Setter for [`bluetoothServiceDataBlob`][Self::bluetoothServiceDataBlob].
253        ///
254        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
255        ///
256        /// # Safety
257        ///
258        /// This might not be thread-safe.
259        #[unsafe(method(setBluetoothServiceDataBlob:))]
260        #[unsafe(method_family = none)]
261        pub unsafe fn setBluetoothServiceDataBlob(
262            &self,
263            bluetooth_service_data_blob: Option<&NSData>,
264        );
265
266        /// The accessory's Bluetooth service data mask.
267        ///
268        /// This property is not atomic.
269        ///
270        /// # Safety
271        ///
272        /// This might not be thread-safe.
273        #[unsafe(method(bluetoothServiceDataMask))]
274        #[unsafe(method_family = none)]
275        pub unsafe fn bluetoothServiceDataMask(&self) -> Option<Retained<NSData>>;
276
277        /// Setter for [`bluetoothServiceDataMask`][Self::bluetoothServiceDataMask].
278        ///
279        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
280        ///
281        /// # Safety
282        ///
283        /// This might not be thread-safe.
284        #[unsafe(method(setBluetoothServiceDataMask:))]
285        #[unsafe(method_family = none)]
286        pub unsafe fn setBluetoothServiceDataMask(
287            &self,
288            bluetooth_service_data_mask: Option<&NSData>,
289        );
290
291        #[cfg(feature = "objc2-core-bluetooth")]
292        /// The accessory's Bluetooth service UUID.
293        ///
294        /// This property is not atomic.
295        ///
296        /// # Safety
297        ///
298        /// This might not be thread-safe.
299        #[unsafe(method(bluetoothServiceUUID))]
300        #[unsafe(method_family = none)]
301        pub unsafe fn bluetoothServiceUUID(&self) -> Option<Retained<CBUUID>>;
302
303        #[cfg(feature = "objc2-core-bluetooth")]
304        /// Setter for [`bluetoothServiceUUID`][Self::bluetoothServiceUUID].
305        ///
306        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
307        ///
308        /// # Safety
309        ///
310        /// This might not be thread-safe.
311        #[unsafe(method(setBluetoothServiceUUID:))]
312        #[unsafe(method_family = none)]
313        pub unsafe fn setBluetoothServiceUUID(&self, bluetooth_service_uuid: Option<&CBUUID>);
314
315        /// The SSID of the accessory's Wi-Fi network.
316        ///
317        /// This property is not atomic.
318        ///
319        /// # Safety
320        ///
321        /// This might not be thread-safe.
322        #[unsafe(method(SSID))]
323        #[unsafe(method_family = none)]
324        pub unsafe fn SSID(&self) -> Option<Retained<NSString>>;
325
326        /// Setter for [`SSID`][Self::SSID].
327        ///
328        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
329        ///
330        /// # Safety
331        ///
332        /// This might not be thread-safe.
333        #[unsafe(method(setSSID:))]
334        #[unsafe(method_family = none)]
335        pub unsafe fn setSSID(&self, ssid: Option<&NSString>);
336
337        /// The prefix string of SSID of the accessory's Wi-Fi network.
338        ///
339        /// This property is not atomic.
340        ///
341        /// # Safety
342        ///
343        /// This might not be thread-safe.
344        #[unsafe(method(SSIDPrefix))]
345        #[unsafe(method_family = none)]
346        pub unsafe fn SSIDPrefix(&self) -> Option<Retained<NSString>>;
347
348        /// Setter for [`SSIDPrefix`][Self::SSIDPrefix].
349        ///
350        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
351        ///
352        /// # Safety
353        ///
354        /// This might not be thread-safe.
355        #[unsafe(method(setSSIDPrefix:))]
356        #[unsafe(method_family = none)]
357        pub unsafe fn setSSIDPrefix(&self, ssid_prefix: Option<&NSString>);
358
359        /// The accessory's Wi-Fi Aware's service name if available.
360        ///
361        /// This property is not atomic.
362        ///
363        /// # Safety
364        ///
365        /// This might not be thread-safe.
366        #[unsafe(method(wifiAwareServiceName))]
367        #[unsafe(method_family = none)]
368        pub unsafe fn wifiAwareServiceName(&self) -> Option<Retained<NSString>>;
369
370        /// Setter for [`wifiAwareServiceName`][Self::wifiAwareServiceName].
371        ///
372        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
373        ///
374        /// # Safety
375        ///
376        /// This might not be thread-safe.
377        #[unsafe(method(setWifiAwareServiceName:))]
378        #[unsafe(method_family = none)]
379        pub unsafe fn setWifiAwareServiceName(&self, wifi_aware_service_name: Option<&NSString>);
380
381        /// The role of the accessory's Wi-Fi Aware's service.
382        ///
383        /// This property defaults to ``ASDiscoveryDescriptor/WiFiAwareServiceRole/subscriber``
384        ///
385        /// This property is not atomic.
386        ///
387        /// # Safety
388        ///
389        /// This might not be thread-safe.
390        #[unsafe(method(wifiAwareServiceRole))]
391        #[unsafe(method_family = none)]
392        pub unsafe fn wifiAwareServiceRole(&self) -> ASDiscoveryDescriptorWiFiAwareServiceRole;
393
394        /// Setter for [`wifiAwareServiceRole`][Self::wifiAwareServiceRole].
395        ///
396        /// # Safety
397        ///
398        /// This might not be thread-safe.
399        #[unsafe(method(setWifiAwareServiceRole:))]
400        #[unsafe(method_family = none)]
401        pub unsafe fn setWifiAwareServiceRole(
402            &self,
403            wifi_aware_service_role: ASDiscoveryDescriptorWiFiAwareServiceRole,
404        );
405
406        #[cfg(feature = "ASCommon")]
407        /// The accessory's Wi-Fi Aware model name and matching options.
408        ///
409        /// This property is not atomic.
410        ///
411        /// # Safety
412        ///
413        /// This might not be thread-safe.
414        #[unsafe(method(wifiAwareModelNameMatch))]
415        #[unsafe(method_family = none)]
416        pub unsafe fn wifiAwareModelNameMatch(&self) -> Option<Retained<ASPropertyCompareString>>;
417
418        #[cfg(feature = "ASCommon")]
419        /// Setter for [`wifiAwareModelNameMatch`][Self::wifiAwareModelNameMatch].
420        ///
421        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
422        ///
423        /// # Safety
424        ///
425        /// This might not be thread-safe.
426        #[unsafe(method(setWifiAwareModelNameMatch:))]
427        #[unsafe(method_family = none)]
428        pub unsafe fn setWifiAwareModelNameMatch(
429            &self,
430            wifi_aware_model_name_match: Option<&ASPropertyCompareString>,
431        );
432
433        #[cfg(feature = "ASCommon")]
434        /// The accessory's Wi-Fi Aware vendor name and matching options.
435        ///
436        /// This property is not atomic.
437        ///
438        /// # Safety
439        ///
440        /// This might not be thread-safe.
441        #[unsafe(method(wifiAwareVendorNameMatch))]
442        #[unsafe(method_family = none)]
443        pub unsafe fn wifiAwareVendorNameMatch(&self) -> Option<Retained<ASPropertyCompareString>>;
444
445        #[cfg(feature = "ASCommon")]
446        /// Setter for [`wifiAwareVendorNameMatch`][Self::wifiAwareVendorNameMatch].
447        ///
448        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
449        ///
450        /// # Safety
451        ///
452        /// This might not be thread-safe.
453        #[unsafe(method(setWifiAwareVendorNameMatch:))]
454        #[unsafe(method_family = none)]
455        pub unsafe fn setWifiAwareVendorNameMatch(
456            &self,
457            wifi_aware_vendor_name_match: Option<&ASPropertyCompareString>,
458        );
459    );
460}
461
462/// Methods declared on superclass `NSObject`.
463impl ASDiscoveryDescriptor {
464    extern_methods!(
465        #[unsafe(method(init))]
466        #[unsafe(method_family = init)]
467        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
468
469        #[unsafe(method(new))]
470        #[unsafe(method_family = new)]
471        pub unsafe fn new() -> Retained<Self>;
472    );
473}