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 #[unsafe(method(uuidWithBytes:length:))]
53 #[unsafe(method_family = none)]
54 pub unsafe fn uuidWithBytes_length(
55 bytes: *const c_void,
56 length: c_uint,
57 ) -> Option<Retained<Self>>;
58
59 /// Creates a new IOBluetoothSDPUUID object from the given NSData.
60 ///
61 /// If the length of the NSData is invalid for a UUID, nil is returned.
62 ///
63 /// Parameter `data`: The NSData containing the UUID bytes.
64 ///
65 /// Returns: Returns the new IOBluetoothSDPUUID object or nil on failure.
66 #[unsafe(method(uuidWithData:))]
67 #[unsafe(method_family = none)]
68 pub unsafe fn uuidWithData(data: Option<&NSData>) -> Option<Retained<Self>>;
69
70 #[cfg(feature = "Bluetooth")]
71 /// Creates a new 16-bit IOBluetoothSDPUUID with the given UUID16
72 ///
73 /// Parameter `uuid16`: A scalar representing a 16-bit UUID
74 ///
75 /// Returns: Returns the new IOBluetoothSDPUUID object.
76 #[unsafe(method(uuid16:))]
77 #[unsafe(method_family = none)]
78 pub unsafe fn uuid16(uuid16: BluetoothSDPUUID16) -> Option<Retained<Self>>;
79
80 #[cfg(feature = "Bluetooth")]
81 /// Creates a new 32-bit IOBluetoothSDPUUID with the given UUID32
82 ///
83 /// Parameter `uuid32`: A scalar representing a 32-bit UUID
84 ///
85 /// Returns: Returns the new IOBluetoothSDPUUID object.
86 #[unsafe(method(uuid32:))]
87 #[unsafe(method_family = none)]
88 pub unsafe fn uuid32(uuid32: BluetoothSDPUUID32) -> Option<Retained<Self>>;
89
90 #[cfg(feature = "IOBluetoothUserLib")]
91 /// Method call to convert an IOBluetoothSDPUUIDRef into an IOBluetoothSDPUUID *.
92 ///
93 /// Parameter `sdpUUIDRef`: IOBluetoothSDPUUIDRef for which an IOBluetoothSDPUUID * is desired.
94 ///
95 /// Returns: Returns the IOBluetoothSDPUUID * for the given IOBluetoothSDPUUIDRef.
96 #[deprecated]
97 #[unsafe(method(withSDPUUIDRef:))]
98 #[unsafe(method_family = none)]
99 pub unsafe fn withSDPUUIDRef(
100 sdp_uuid_ref: Option<&IOBluetoothSDPUUIDRef>,
101 ) -> Option<Retained<Self>>;
102
103 #[cfg(feature = "Bluetooth")]
104 /// Initializes a new 16-bit IOBluetoothSDPUUID with the given UUID16
105 ///
106 /// Parameter `uuid16`: A scalar representing a 16-bit UUID
107 ///
108 /// Returns: Returns self.
109 #[unsafe(method(initWithUUID16:))]
110 #[unsafe(method_family = init)]
111 pub unsafe fn initWithUUID16(
112 this: Allocated<Self>,
113 uuid16: BluetoothSDPUUID16,
114 ) -> Option<Retained<Self>>;
115
116 #[cfg(feature = "Bluetooth")]
117 /// Creates a new 32-bit IOBluetoothSDPUUID with the given UUID32
118 ///
119 /// Parameter `uuid32`: A scalar representing a 32-bit UUID
120 ///
121 /// Returns: Returns self.
122 #[unsafe(method(initWithUUID32:))]
123 #[unsafe(method_family = init)]
124 pub unsafe fn initWithUUID32(
125 this: Allocated<Self>,
126 uuid32: BluetoothSDPUUID32,
127 ) -> Option<Retained<Self>>;
128
129 #[cfg(feature = "IOBluetoothUserLib")]
130 /// Returns an IOBluetoothSDPUUIDRef representation of the target IOBluetoothSDPUUID object.
131 ///
132 /// Returns: Returns an IOBluetoothSDPUUIDRef representation of the target IOBluetoothSDPUUID object.
133 #[deprecated]
134 #[unsafe(method(getSDPUUIDRef))]
135 #[unsafe(method_family = none)]
136 pub unsafe fn getSDPUUIDRef(&self) -> Option<Retained<IOBluetoothSDPUUIDRef>>;
137
138 /// Returns an IOBluetoothSDPUUID object matching the target UUID, but with the given number of bytes.
139 ///
140 /// If the target object is the same length as newLength, it returns self. If newLength is greater
141 /// it creates a new IOBluetoothSDPUUID object with the correct value for the given length. If
142 /// newLength is smaller, it will attempt to create a new IOBluetoothSDPUUID that is smaller if
143 /// the data matches the Bluetooth UUID base. This downconversion is currently unimplemented.
144 ///
145 /// Parameter `newLength`: The desired length for the UUID.
146 ///
147 /// Returns: Returns an IOBluetoothSDPUUID object with the same data as the target but with the given length if it
148 /// is possible to do so. Otherwise, nil is returned.
149 #[unsafe(method(getUUIDWithLength:))]
150 #[unsafe(method_family = none)]
151 pub unsafe fn getUUIDWithLength(&self, new_length: c_uint) -> Option<Retained<Self>>;
152
153 /// Compares the target IOBluetoothSDPUUID object with the given otherUUID object.
154 ///
155 /// This method will compare the two UUID values independent of their length.
156 ///
157 /// Parameter `otherUUID`: The UUID object to be compared with the target.
158 ///
159 /// Returns: Returns true if the UUID values of each object are equal. This includes the case where the sizes are different
160 /// but the data itself is the same when the Bluetooth UUID base is applied.
161 #[unsafe(method(isEqualToUUID:))]
162 #[unsafe(method_family = none)]
163 pub unsafe fn isEqualToUUID(&self, other_uuid: Option<&IOBluetoothSDPUUID>) -> bool;
164
165 #[unsafe(method(classForCoder))]
166 #[unsafe(method_family = none)]
167 pub unsafe fn classForCoder(&self) -> Option<&'static AnyClass>;
168
169 #[unsafe(method(classForArchiver))]
170 #[unsafe(method_family = none)]
171 pub unsafe fn classForArchiver(&self) -> Option<&'static AnyClass>;
172
173 #[unsafe(method(classForPortCoder))]
174 #[unsafe(method_family = none)]
175 pub unsafe fn classForPortCoder(&self) -> Option<&'static AnyClass>;
176 );
177}
178
179/// Methods declared on superclass `NSObject`.
180#[cfg(feature = "objc2-foundation")]
181impl IOBluetoothSDPUUID {
182 extern_methods!(
183 #[unsafe(method(init))]
184 #[unsafe(method_family = init)]
185 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
186
187 #[unsafe(method(new))]
188 #[unsafe(method_family = new)]
189 pub unsafe fn new() -> Retained<Self>;
190 );
191}