objc2_io_bluetooth/generated/objc2/
IOBluetoothSDPUUID.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-foundation")]
7use objc2_foundation::*;
8
9use crate::*;
10
11extern_class!(
12    /// An NSData subclass that represents a UUID as defined in the Bluetooth SDP spec.
13    ///
14    /// The IOBluetoothSDPUUID class can represent a UUID of any valid size (16, 32 or 128 bits).
15    /// It provides the ability to compare two UUIDs no matter what their size as well as the ability
16    /// to promote the size of a UUID to a larger one.
17    ///
18    /// See also [Apple's documentation](https://developer.apple.com/documentation/iobluetooth/iobluetoothsdpuuid?language=objc)
19    #[unsafe(super(NSData, NSObject))]
20    #[derive(Debug, PartialEq, Eq, Hash)]
21    #[cfg(feature = "objc2-foundation")]
22    pub struct IOBluetoothSDPUUID;
23);
24
25#[cfg(feature = "objc2-foundation")]
26extern_conformance!(
27    unsafe impl NSCoding for IOBluetoothSDPUUID {}
28);
29
30#[cfg(feature = "objc2-foundation")]
31extern_conformance!(
32    unsafe impl NSObjectProtocol for IOBluetoothSDPUUID {}
33);
34
35#[cfg(feature = "objc2-foundation")]
36extern_conformance!(
37    unsafe impl NSSecureCoding for IOBluetoothSDPUUID {}
38);
39
40#[cfg(feature = "objc2-foundation")]
41impl IOBluetoothSDPUUID {
42    extern_methods!(
43        /// Creates a new IOBluetoothSDPUUID object with the given bytes of the given length.
44        ///
45        /// If the length is invalid for a UUID, nil is returned.
46        ///
47        /// Parameter `bytes`: An array of bytes representing the UUID.
48        ///
49        /// Parameter `length`: The length of the array of bytes.
50        ///
51        /// Returns: Returns the new IOBluetoothSDPUUID object or nil on failure.
52        ///
53        /// # Safety
54        ///
55        /// `bytes` must be a valid pointer.
56        #[unsafe(method(uuidWithBytes:length:))]
57        #[unsafe(method_family = none)]
58        pub unsafe fn uuidWithBytes_length(
59            bytes: *const c_void,
60            length: c_uint,
61        ) -> Option<Retained<Self>>;
62
63        /// Creates a new IOBluetoothSDPUUID object from the given NSData.
64        ///
65        /// If the length of the NSData is invalid for a UUID, nil is returned.
66        ///
67        /// Parameter `data`: The NSData containing the UUID bytes.
68        ///
69        /// Returns: Returns the new IOBluetoothSDPUUID object or nil on failure.
70        ///
71        /// # Safety
72        ///
73        /// `data` might not allow `None`.
74        #[unsafe(method(uuidWithData:))]
75        #[unsafe(method_family = none)]
76        pub unsafe fn uuidWithData(data: Option<&NSData>) -> Option<Retained<Self>>;
77
78        #[cfg(feature = "Bluetooth")]
79        /// Creates a new 16-bit IOBluetoothSDPUUID with the given UUID16
80        ///
81        /// Parameter `uuid16`: A scalar representing a 16-bit UUID
82        ///
83        /// Returns: Returns the new IOBluetoothSDPUUID object.
84        #[unsafe(method(uuid16:))]
85        #[unsafe(method_family = none)]
86        pub unsafe fn uuid16(uuid16: BluetoothSDPUUID16) -> Option<Retained<Self>>;
87
88        #[cfg(feature = "Bluetooth")]
89        /// Creates a new 32-bit IOBluetoothSDPUUID with the given UUID32
90        ///
91        /// Parameter `uuid32`: A scalar representing a 32-bit UUID
92        ///
93        /// Returns: Returns the new IOBluetoothSDPUUID object.
94        #[unsafe(method(uuid32:))]
95        #[unsafe(method_family = none)]
96        pub unsafe fn uuid32(uuid32: BluetoothSDPUUID32) -> Option<Retained<Self>>;
97
98        #[cfg(feature = "IOBluetoothUserLib")]
99        /// Method call to convert an IOBluetoothSDPUUIDRef into an IOBluetoothSDPUUID *.
100        ///
101        /// Parameter `sdpUUIDRef`: IOBluetoothSDPUUIDRef for which an IOBluetoothSDPUUID * is desired.
102        ///
103        /// Returns: Returns the IOBluetoothSDPUUID * for the given IOBluetoothSDPUUIDRef.
104        ///
105        /// # Safety
106        ///
107        /// `sdp_uuid_ref` might not allow `None`.
108        #[deprecated]
109        #[unsafe(method(withSDPUUIDRef:))]
110        #[unsafe(method_family = none)]
111        pub unsafe fn withSDPUUIDRef(
112            sdp_uuid_ref: Option<&IOBluetoothSDPUUIDRef>,
113        ) -> Option<Retained<Self>>;
114
115        #[cfg(feature = "Bluetooth")]
116        /// Initializes a new 16-bit IOBluetoothSDPUUID with the given UUID16
117        ///
118        /// Parameter `uuid16`: A scalar representing a 16-bit UUID
119        ///
120        /// Returns: Returns self.
121        #[unsafe(method(initWithUUID16:))]
122        #[unsafe(method_family = init)]
123        pub unsafe fn initWithUUID16(
124            this: Allocated<Self>,
125            uuid16: BluetoothSDPUUID16,
126        ) -> Option<Retained<Self>>;
127
128        #[cfg(feature = "Bluetooth")]
129        /// Creates a new 32-bit IOBluetoothSDPUUID with the given UUID32
130        ///
131        /// Parameter `uuid32`: A scalar representing a 32-bit UUID
132        ///
133        /// Returns: Returns self.
134        #[unsafe(method(initWithUUID32:))]
135        #[unsafe(method_family = init)]
136        pub unsafe fn initWithUUID32(
137            this: Allocated<Self>,
138            uuid32: BluetoothSDPUUID32,
139        ) -> Option<Retained<Self>>;
140
141        #[cfg(feature = "IOBluetoothUserLib")]
142        /// Returns an IOBluetoothSDPUUIDRef representation of the target IOBluetoothSDPUUID object.
143        ///
144        /// Returns: Returns an IOBluetoothSDPUUIDRef representation of the target IOBluetoothSDPUUID object.
145        #[deprecated]
146        #[unsafe(method(getSDPUUIDRef))]
147        #[unsafe(method_family = none)]
148        pub unsafe fn getSDPUUIDRef(&self) -> Option<Retained<IOBluetoothSDPUUIDRef>>;
149
150        /// Returns an IOBluetoothSDPUUID object matching the target UUID, but with the given number of bytes.
151        ///
152        /// If the target object is the same length as newLength, it returns self.  If newLength is greater
153        /// it creates a new IOBluetoothSDPUUID object with the correct value for the given length.  If
154        /// newLength is smaller, it will attempt to create a new IOBluetoothSDPUUID that is smaller if
155        /// the data matches the Bluetooth UUID base.  This downconversion is currently unimplemented.
156        ///
157        /// Parameter `newLength`: The desired length for the UUID.
158        ///
159        /// Returns: Returns an IOBluetoothSDPUUID object with the same data as the target but with the given length if it
160        /// is possible to do so.  Otherwise, nil is returned.
161        #[unsafe(method(getUUIDWithLength:))]
162        #[unsafe(method_family = none)]
163        pub unsafe fn getUUIDWithLength(&self, new_length: c_uint) -> Option<Retained<Self>>;
164
165        /// Compares the target IOBluetoothSDPUUID object with the given otherUUID object.
166        ///
167        /// This method will compare the two UUID values independent of their length.
168        ///
169        /// Parameter `otherUUID`: The UUID object to be compared with the target.
170        ///
171        /// Returns: Returns true if the UUID values of each object are equal.  This includes the case where the sizes are different
172        /// but the data itself is the same when the Bluetooth UUID base is applied.
173        ///
174        /// # Safety
175        ///
176        /// `other_uuid` might not allow `None`.
177        #[unsafe(method(isEqualToUUID:))]
178        #[unsafe(method_family = none)]
179        pub unsafe fn isEqualToUUID(&self, other_uuid: Option<&IOBluetoothSDPUUID>) -> bool;
180
181        #[unsafe(method(classForCoder))]
182        #[unsafe(method_family = none)]
183        pub unsafe fn classForCoder(&self) -> Option<&'static AnyClass>;
184
185        #[unsafe(method(classForArchiver))]
186        #[unsafe(method_family = none)]
187        pub unsafe fn classForArchiver(&self) -> Option<&'static AnyClass>;
188
189        #[unsafe(method(classForPortCoder))]
190        #[unsafe(method_family = none)]
191        pub unsafe fn classForPortCoder(&self) -> Option<&'static AnyClass>;
192    );
193}
194
195/// Methods declared on superclass `NSObject`.
196#[cfg(feature = "objc2-foundation")]
197impl IOBluetoothSDPUUID {
198    extern_methods!(
199        #[unsafe(method(init))]
200        #[unsafe(method_family = init)]
201        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
202
203        #[unsafe(method(new))]
204        #[unsafe(method_family = new)]
205        pub unsafe fn new() -> Retained<Self>;
206    );
207}