objc2_io_bluetooth/generated/objc2/
IOBluetoothDevice.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_protocol!(
12    /// [Apple's documentation](https://developer.apple.com/documentation/iobluetooth/iobluetoothdeviceasynccallbacks?language=objc)
13    pub unsafe trait IOBluetoothDeviceAsyncCallbacks {
14        #[cfg(feature = "IOBluetoothObject")]
15        /// # Safety
16        ///
17        /// `device` might not allow `None`.
18        #[unsafe(method(remoteNameRequestComplete:status:))]
19        #[unsafe(method_family = none)]
20        unsafe fn remoteNameRequestComplete_status(
21            &self,
22            device: Option<&IOBluetoothDevice>,
23            status: IOReturn,
24        );
25
26        #[cfg(feature = "IOBluetoothObject")]
27        /// # Safety
28        ///
29        /// `device` might not allow `None`.
30        #[unsafe(method(connectionComplete:status:))]
31        #[unsafe(method_family = none)]
32        unsafe fn connectionComplete_status(
33            &self,
34            device: Option<&IOBluetoothDevice>,
35            status: IOReturn,
36        );
37
38        #[cfg(feature = "IOBluetoothObject")]
39        /// # Safety
40        ///
41        /// `device` might not allow `None`.
42        #[unsafe(method(sdpQueryComplete:status:))]
43        #[unsafe(method_family = none)]
44        unsafe fn sdpQueryComplete_status(
45            &self,
46            device: Option<&IOBluetoothDevice>,
47            status: IOReturn,
48        );
49    }
50);
51
52extern_class!(
53    /// An instance of IOBluetoothDevice represents a single remote Bluetooth device.
54    ///
55    /// An IOBluetoothDevice object may exist independent of the existence of a baseband connection
56    /// with the target device.  Using this object, a client can request creation and destruction of baseband
57    /// connections, and request the opening of L2CAP and RFCOMM channels on the remote device.  Many of the other
58    /// APIs in the IOBluetooth framework will return this object, or it's C counterpart (IOBluetoothDeviceRef).
59    ///
60    /// See also [Apple's documentation](https://developer.apple.com/documentation/iobluetooth/iobluetoothdevice?language=objc)
61    #[unsafe(super(IOBluetoothObject, NSObject))]
62    #[derive(Debug, PartialEq, Eq, Hash)]
63    #[cfg(feature = "IOBluetoothObject")]
64    pub struct IOBluetoothDevice;
65);
66
67#[cfg(all(feature = "IOBluetoothObject", feature = "objc2-foundation"))]
68extern_conformance!(
69    unsafe impl NSCoding for IOBluetoothDevice {}
70);
71
72#[cfg(all(feature = "IOBluetoothObject", feature = "objc2-foundation"))]
73extern_conformance!(
74    unsafe impl NSCopying for IOBluetoothDevice {}
75);
76
77#[cfg(all(feature = "IOBluetoothObject", feature = "objc2-foundation"))]
78unsafe impl CopyingHelper for IOBluetoothDevice {
79    type Result = Self;
80}
81
82#[cfg(feature = "IOBluetoothObject")]
83extern_conformance!(
84    unsafe impl NSObjectProtocol for IOBluetoothDevice {}
85);
86
87#[cfg(all(feature = "IOBluetoothObject", feature = "objc2-foundation"))]
88extern_conformance!(
89    unsafe impl NSSecureCoding for IOBluetoothDevice {}
90);
91
92#[cfg(feature = "IOBluetoothObject")]
93impl IOBluetoothDevice {
94    extern_methods!(
95        #[cfg(feature = "IOBluetoothUserNotification")]
96        /// Allows a client to register for device connect notifications for any connection.
97        ///
98        /// The given selector will be called on the target observer whenever any device connection is made.
99        /// The selector should accept two arguments.  The first is the user notification object.  The second
100        /// is the device that was connected.
101        ///
102        /// Parameter `observer`: Target observer object
103        ///
104        /// Parameter `inSelector`: Selector to be sent to the observer when a new connection is made
105        ///
106        /// Returns: Returns an IOBluetoothUserNotification representing the outstanding device connect notification.
107        /// To unregister the notification, call -unregister on the returned IOBluetoothUserNotification
108        /// object.  If an error is encountered creating the notification, nil is returned.  The returned
109        /// IOBluetoothUserNotification object will be valid for as long as the notification is registered.
110        /// It is not necessary to retain the result.  Once -unregister is called on it, it will no longer
111        /// be valid.
112        ///
113        /// # Safety
114        ///
115        /// - `observer` should be of the correct type.
116        /// - `observer` might not allow `None`.
117        /// - `in_selector` must be a valid selector.
118        #[unsafe(method(registerForConnectNotifications:selector:))]
119        #[unsafe(method_family = none)]
120        pub unsafe fn registerForConnectNotifications_selector(
121            observer: Option<&AnyObject>,
122            in_selector: Option<Sel>,
123        ) -> Option<Retained<IOBluetoothUserNotification>>;
124
125        #[cfg(feature = "IOBluetoothUserNotification")]
126        /// Allows a client to register for device disconnect notification.
127        ///
128        /// The given selector will be called on the target observer when the target device's connection is
129        /// closed.  The selector should contain two arguments.  The first is the user notification object.  The second
130        /// is the IOBluetoothDevice that was disconnected.
131        ///
132        /// Parameter `observer`: Target observer object
133        ///
134        /// Parameter `inSelector`: Selector to be sent to the observer when the connection is destroyed
135        ///
136        /// Returns: Returns an IOBluetoothUserNotification representing the outstanding device disconnect notification.
137        /// To unregister the notification, call -unregister of the returned IOBluetoothUserNotification
138        /// object.  If an error is encountered creating the notification, nil is returned.
139        ///
140        /// # Safety
141        ///
142        /// - `observer` should be of the correct type.
143        /// - `observer` might not allow `None`.
144        /// - `in_selector` must be a valid selector.
145        #[unsafe(method(registerForDisconnectNotification:selector:))]
146        #[unsafe(method_family = none)]
147        pub unsafe fn registerForDisconnectNotification_selector(
148            &self,
149            observer: Option<&AnyObject>,
150            in_selector: Option<Sel>,
151        ) -> Option<Retained<IOBluetoothUserNotification>>;
152
153        #[cfg(feature = "Bluetooth")]
154        /// Returns the IOBluetoothDevice object for the given BluetoothDeviceAddress
155        ///
156        /// Within a single application, there will be only one instance of IOBluetoothDevice for a
157        /// given remote device address.
158        ///
159        /// Parameter `address`: Pointer to a BluetoothDeviceAddress for which an IOBluetoothDevice instance is desired
160        ///
161        /// Returns: Returns the IOBluetoothDevice object for the given BluetoothDeviceAddress
162        ///
163        /// # Safety
164        ///
165        /// `address` must be a valid pointer.
166        #[unsafe(method(deviceWithAddress:))]
167        #[unsafe(method_family = none)]
168        pub unsafe fn deviceWithAddress(
169            address: *const BluetoothDeviceAddress,
170        ) -> Option<Retained<Self>>;
171
172        #[cfg(feature = "Bluetooth")]
173        /// # Safety
174        ///
175        /// `address` must be a valid pointer.
176        #[deprecated]
177        #[unsafe(method(withAddress:))]
178        #[unsafe(method_family = none)]
179        pub unsafe fn withAddress(address: *const BluetoothDeviceAddress)
180            -> Option<Retained<Self>>;
181
182        #[cfg(feature = "objc2-foundation")]
183        /// Returns the IOBluetoothDevice object for the given BluetoothDeviceAddress
184        ///
185        /// Within a single application, there will be only one instance of IOBluetoothDevice for a
186        /// given remote device address.
187        ///
188        /// Parameter `address`: Pointer to an NSString containing the BD_ADDR for which an IOBluetoothDevice instance is desired.  The string should be of the form xx:xx:xx:xx:xx:xx
189        ///
190        /// Returns: Returns the IOBluetoothDevice object for the given BluetoothDeviceAddress
191        ///
192        /// # Safety
193        ///
194        /// `address` might not allow `None`.
195        #[unsafe(method(deviceWithAddressString:))]
196        #[unsafe(method_family = none)]
197        pub unsafe fn deviceWithAddressString(address: Option<&NSString>)
198            -> Option<Retained<Self>>;
199
200        #[cfg(feature = "IOBluetoothUserLib")]
201        /// Method call to convert an IOBluetoothDeviceRef into an IOBluetoothDevice *.
202        ///
203        /// IOBluetoothDeviceRef and it's API are deprecated.  An IOBluetoothDeviceRef can be cast to a IOBluetoothDevice *
204        ///
205        /// Parameter `deviceRef`: IOBluetoothDeviceRef for which an IOBluetoothDevice * is desired.
206        ///
207        /// Returns: Returns the IOBluetoothDevice * for the given IOBluetoothDeviceRef.
208        ///
209        /// # Safety
210        ///
211        /// `device_ref` might not allow `None`.
212        #[deprecated]
213        #[unsafe(method(withDeviceRef:))]
214        #[unsafe(method_family = none)]
215        pub unsafe fn withDeviceRef(
216            device_ref: Option<&IOBluetoothDeviceRef>,
217        ) -> Option<Retained<Self>>;
218
219        #[cfg(feature = "IOBluetoothUserLib")]
220        /// Returns an IOBluetoothDeviceRef representation of the target IOBluetoothDevice object.
221        ///
222        /// IOBluetoothDeviceRef and it's API are deprecated.  An IOBluetoothDeviceRef can be cast to a IOBluetoothDevice *
223        ///
224        /// Returns: Returns an IOBluetoothDeviceRef representation of the target IOBluetoothDevice object.
225        #[deprecated]
226        #[unsafe(method(getDeviceRef))]
227        #[unsafe(method_family = none)]
228        pub unsafe fn getDeviceRef(&self) -> Option<Retained<IOBluetoothDeviceRef>>;
229
230        #[cfg(all(feature = "Bluetooth", feature = "IOBluetoothL2CAPChannel"))]
231        /// Opens a new L2CAP channel to the target device. Returns only after the channel is opened.
232        ///
233        /// This method will begin the process of opening a new L2CAP channel to the target device.
234        /// The baseband connection to the device will be opened if it is not open already.  The L2CAP
235        /// channel open process will not complete until the client has registered an incoming data
236        /// listener on the new channel.  This prevents a situation where the channel succeeds
237        /// in being configured and opened and receives data before the client is listening and
238        /// is ready for it.
239        ///
240        /// NOTE: This method is only available in Mac OS X 10.2.5 (Bluetooth v1.2) or later.
241        ///
242        /// Parameter `newChannel`: A pointer to an IOBluetoothL2CAPChannel object to receive the L2CAP channel
243        /// requested to be opened.  The newChannel pointer will only be set if
244        /// kIOReturnSuccess is returned.
245        ///
246        /// Parameter `withPSM`: The L2CAP PSM value for the new channel.
247        ///
248        /// Parameter `channelDelegate`: the object that will play the role of delegate for the channel.
249        /// A channel delegate is the object the l2cap uses as target for  data and events. The
250        /// developer will implement only the the methods he/she is interested in. A list of the
251        /// possible methods is at the end of the file "IOBluetoothL2CAPChannel.h" in the definition
252        /// of the protocol IOBluetoothL2CAPChannelDelegate.
253        ///
254        ///
255        /// Returns: Returns kIOReturnSuccess if the open process was successfully started (or if an existing
256        /// L2CAP channel was found).
257        ///
258        /// # Safety
259        ///
260        /// - `new_channel` might not allow `None`.
261        /// - `channel_delegate` should be of the correct type.
262        /// - `channel_delegate` might not allow `None`.
263        #[unsafe(method(openL2CAPChannelSync:withPSM:delegate:))]
264        #[unsafe(method_family = none)]
265        pub unsafe fn openL2CAPChannelSync_withPSM_delegate(
266            &self,
267            new_channel: Option<&mut Option<Retained<IOBluetoothL2CAPChannel>>>,
268            psm: BluetoothL2CAPPSM,
269            channel_delegate: Option<&AnyObject>,
270        ) -> IOReturn;
271
272        #[cfg(all(feature = "Bluetooth", feature = "IOBluetoothL2CAPChannel"))]
273        /// Opens a new L2CAP channel to the target device. Returns immediately after starting the opening process.
274        ///
275        /// This method will begin the process of opening a new L2CAP channel to the target device.
276        /// The baseband connection to the device will be opened if it is not open already.  The L2CAP
277        /// channel open process will not complete until the client has registered an incoming data
278        /// listener on the new channel.  This prevents a situation where the channel succeeds
279        /// in being configured and opened and receives data before the client is listening and
280        /// is ready for it.
281        ///
282        /// NOTE: This method is only available in Mac OS X 10.2.5 (Bluetooth v1.2) or later.
283        ///
284        /// Parameter `newChannel`: A pointer to an IOBluetoothL2CAPChannel object to receive the L2CAP channel
285        /// requested to be opened.  The newChannel pointer will only be set if
286        /// kIOReturnSuccess is returned.
287        ///
288        /// Parameter `psm`: The L2CAP PSM value for the new channel.
289        ///
290        /// Parameter `channelDelegate`: the object that will play the role of delegate for the channel.
291        /// A channel delegate is the object the l2cap uses as target for  data and events. The
292        /// developer will implement only the the methods he/she is interested in. A list of the
293        /// possible methods is at the end of the file "IOBluetoothL2CAPChannel.h" in the definition
294        /// of the protocol IOBluetoothL2CAPChannelDelegate.
295        ///
296        ///
297        /// Returns: Returns kIOReturnSuccess if the open process was successfully started (or if an existing
298        /// L2CAP channel was found).
299        ///
300        /// # Safety
301        ///
302        /// - `new_channel` might not allow `None`.
303        /// - `channel_delegate` should be of the correct type.
304        /// - `channel_delegate` might not allow `None`.
305        #[unsafe(method(openL2CAPChannelAsync:withPSM:delegate:))]
306        #[unsafe(method_family = none)]
307        pub unsafe fn openL2CAPChannelAsync_withPSM_delegate(
308            &self,
309            new_channel: Option<&mut Option<Retained<IOBluetoothL2CAPChannel>>>,
310            psm: BluetoothL2CAPPSM,
311            channel_delegate: Option<&AnyObject>,
312        ) -> IOReturn;
313
314        #[cfg(all(feature = "Bluetooth", feature = "IOBluetoothL2CAPChannel"))]
315        /// Opens a new L2CAP channel to the target device. Returns immedialty after starting the opening process.
316        ///
317        /// This method will begin the process of opening a new L2CAP channel to the target device.
318        /// The baseband connection to the device will be opened if it is not open already.  The L2CAP
319        /// channel open process will not complete until the client has registered an incoming data
320        /// listener on the new channel.  This prevents a situation where the channel succeeds
321        /// in being configured and opened and receives data before the client is listening and
322        /// is ready for it.
323        ///
324        /// Parameter `psm`: The L2CAP PSM value for the new channel.
325        ///
326        /// Parameter `findExisting`: This value should be set to TRUE if it should look for an existing channel
327        /// with the PSM.  Typically this value will be FALSE.  It should be TRUE only
328        /// in the case where a single channel is allowed by the spec for the given PSM.
329        ///
330        /// Parameter `newChannel`: A pointer to an IOBluetoothL2CAPChannel object to receive the L2CAP channel
331        /// requested to be opened.  The newChannel pointer will only be set if
332        /// kIOReturnSuccess is returned.
333        ///
334        /// Returns: Returns kIOReturnSuccess if the open process was successfully started (or if an existing
335        /// L2CAP channel was found).
336        ///
337        /// # Safety
338        ///
339        /// `new_channel` might not allow `None`.
340        #[deprecated]
341        #[unsafe(method(openL2CAPChannel:findExisting:newChannel:))]
342        #[unsafe(method_family = none)]
343        pub unsafe fn openL2CAPChannel_findExisting_newChannel(
344            &self,
345            psm: BluetoothL2CAPPSM,
346            find_existing: bool,
347            new_channel: Option<&mut Option<Retained<IOBluetoothL2CAPChannel>>>,
348        ) -> IOReturn;
349
350        /// Send an echo request over the L2CAP connection to a remote device.
351        ///
352        /// The current implementation returns when the request has been sent, but does not indicate when
353        /// a response is received.  Also, the baseband connection must be up for the echo request to be sent.
354        /// In the future, this method will also open the connection if necessary.  The API will be updated
355        /// to allow the client to be informed when the echo response has been received (both synchronously
356        /// and asynchronously).
357        ///
358        /// Parameter `data`: (void *) - Pointer to buffer to send.
359        ///
360        /// Parameter `length`: (UInt16) - Length of the buffer to send
361        ///
362        /// Returns: Returns kIOReturnSuccess if the echo request was able to be sent.
363        ///
364        /// # Safety
365        ///
366        /// `data` must be a valid pointer.
367        #[unsafe(method(sendL2CAPEchoRequest:length:))]
368        #[unsafe(method_family = none)]
369        pub unsafe fn sendL2CAPEchoRequest_length(
370            &self,
371            data: *mut c_void,
372            length: u16,
373        ) -> IOReturn;
374
375        #[cfg(all(feature = "Bluetooth", feature = "IOBluetoothRFCOMMChannel"))]
376        /// Opens a new RFCOMM channel to the target device. Returns only once the channel is open or failed to open.
377        ///
378        /// This method will begin the process of opening a new RFCOMM channel to the target device.
379        /// The baseband connection to the device will be opened if it is not open already.  The RFCOMM
380        /// channel open process will not complete until the client has registered an incoming data
381        /// listener on the new channel.
382        ///
383        /// Parameter `channelID`: The RFCOMM channel ID for the new channel.
384        ///
385        /// Parameter `rfcommChannel`: A pointer to an IOBluetoothRFCOMMChannel object to receive the RFCOMM channel
386        /// requested to be opened.  The rfcommChannel pointer will only be set if
387        /// kIOReturnSuccess is returned.
388        ///
389        /// Returns: Returns kIOReturnSuccess if the open process was successfully started (or if an existing
390        /// RFCOMM channel was found).
391        ///
392        /// # Safety
393        ///
394        /// `rfcomm_channel` might not allow `None`.
395        #[deprecated]
396        #[unsafe(method(openRFCOMMChannel:channel:))]
397        #[unsafe(method_family = none)]
398        pub unsafe fn openRFCOMMChannel_channel(
399            &self,
400            channel_id: BluetoothRFCOMMChannelID,
401            rfcomm_channel: Option<&mut Option<Retained<IOBluetoothRFCOMMChannel>>>,
402        ) -> IOReturn;
403
404        #[cfg(all(feature = "Bluetooth", feature = "IOBluetoothRFCOMMChannel"))]
405        /// Opens a new RFCOMM channel to the target device.  Returns only once the channel is open or failed to open.
406        ///
407        /// This method will begin the process of opening a new RFCOMM channel to the target device.
408        /// The baseband connection to the device will be opened if it is not open already.  The RFCOMM
409        /// channel open process will not complete until the client has registered an incoming data
410        /// listener on the new channel. The RFCOMM channel object is already retained when this function returns success;
411        /// the channel must be released when the caller is done with it.
412        ///
413        /// You should verify that the channel you wish to open exists on the remote device before attempting to open it,
414        /// by performing an SDP query. This is recommended because the service might have been removed from the,
415        /// remote device or the channel assignments for the service could have changed (this is rare, but it does happen
416        /// frequently on some devices). This also works around a bug that existed in early Leopard versions in certain
417        /// situations where the method would return an error; in these instances, the desired RFCOMM channel could not
418        /// be opened again until the calling app was restarted.
419        ///
420        /// NOTE:    This method is only available in Mac OS X 10.2.5 (Bluetooth v1.2) or later.
421        ///
422        ///
423        /// Parameter `rfcommChannel`: A pointer to an IOBluetoothRFCOMMChannel object to receive the RFCOMM channel
424        /// requested to be opened.  The rfcommChannel pointer will only be set if
425        /// kIOReturnSuccess is returned.
426        ///
427        ///
428        /// Parameter `channelID`: The RFCOMM channel ID for the new channel.
429        ///
430        ///
431        /// Parameter `channelDelegate`: the object that will play the role of delegate for the channel.
432        /// A channel delegate is the object the rfcomm uses as target for  data and events. The
433        /// developer will implement only the the methods he/she is interested in. A list of the
434        /// possible methods is at the end of the file "IOBluetoothRFCOMMChannel.h" in the definition
435        /// of the protocol IOBluetoothRFCOMMChannelDelegate.
436        ///
437        ///
438        /// Returns: Returns kIOReturnSuccess if the open process was successfully started (or if an existing
439        /// RFCOMM channel was found). The channel must be released when the caller is done with it.
440        ///
441        /// # Safety
442        ///
443        /// - `rfcomm_channel` might not allow `None`.
444        /// - `channel_delegate` should be of the correct type.
445        /// - `channel_delegate` might not allow `None`.
446        #[unsafe(method(openRFCOMMChannelSync:withChannelID:delegate:))]
447        #[unsafe(method_family = none)]
448        pub unsafe fn openRFCOMMChannelSync_withChannelID_delegate(
449            &self,
450            rfcomm_channel: Option<&mut Option<Retained<IOBluetoothRFCOMMChannel>>>,
451            channel_id: BluetoothRFCOMMChannelID,
452            channel_delegate: Option<&AnyObject>,
453        ) -> IOReturn;
454
455        #[cfg(all(feature = "Bluetooth", feature = "IOBluetoothRFCOMMChannel"))]
456        /// Opens a new RFCOMM channel to the target device. Returns immediately.
457        ///
458        /// This method will begin the process of opening a new RFCOMM channel to the target device.
459        /// The baseband connection to the device will be opened if it is not open already.  The RFCOMM
460        /// channel open process will not complete until the client has registered an incoming data
461        /// listener on the new channel. The RFCOMM channel object is already retained when this function returns success;
462        /// the channel must be released when the caller is done with it.
463        ///
464        /// You should verify that the channel you wish to open exists on the remote device before attempting to open it,
465        /// by performing an SDP query. This is recommended because the service might have been removed from the,
466        /// remote device or the channel assignments for the service could have changed (this is rare, but it does happen
467        /// frequently on some devices). This also works around a bug that existed in early Leopard versions in certain
468        /// situations where the method would return an error; in these instances, the desired RFCOMM channel could not
469        /// be opened again until the calling app was restarted.
470        ///
471        /// NOTE: This method is only available in Mac OS X 10.2.5 (Bluetooth v1.2) or later.
472        ///
473        ///
474        /// Parameter `rfcommChannel`: A pointer to an IOBluetoothRFCOMMChannel object to receive the RFCOMM channel
475        /// requested to be opened.  The rfcommChannel pointer will only be set if
476        /// kIOReturnSuccess is returned.
477        ///
478        ///
479        /// Parameter `channelID`: The RFCOMM channel ID for the new channel.
480        ///
481        ///
482        /// Parameter `channelDelegate`: the object that will play the role of delegate for the channel.
483        /// A channel delegate is the object the rfcomm uses as target for  data and events. The
484        /// developer will implement only the the methods he/she is interested in. A list of the
485        /// possible methods is at the end of the file "IOBluetoothRFCOMMChannel.h" in the definition
486        /// of the protocol IOBluetoothRFCOMMChannelDelegate.
487        ///
488        ///
489        /// Returns: Returns kIOReturnSuccess if the open process was successfully started (or if an existing
490        /// RFCOMM channel was found). The channel must be released when the caller is done with it.
491        ///
492        /// # Safety
493        ///
494        /// - `rfcomm_channel` might not allow `None`.
495        /// - `channel_delegate` should be of the correct type.
496        /// - `channel_delegate` might not allow `None`.
497        #[unsafe(method(openRFCOMMChannelAsync:withChannelID:delegate:))]
498        #[unsafe(method_family = none)]
499        pub unsafe fn openRFCOMMChannelAsync_withChannelID_delegate(
500            &self,
501            rfcomm_channel: Option<&mut Option<Retained<IOBluetoothRFCOMMChannel>>>,
502            channel_id: BluetoothRFCOMMChannelID,
503            channel_delegate: Option<&AnyObject>,
504        ) -> IOReturn;
505
506        #[cfg(feature = "Bluetooth")]
507        /// Gets the full class of device value for the remote device.
508        ///
509        /// This value is only meaningful if the target device has been seen during an inquiry.  This can be
510        /// by checking the result of -getLastInquiryUpdate.  If nil is returned, then the device hasn't been
511        /// seen.
512        ///
513        /// Returns: Returns the class of device for the remote device.
514        #[unsafe(method(classOfDevice))]
515        #[unsafe(method_family = none)]
516        pub unsafe fn classOfDevice(&self) -> BluetoothClassOfDevice;
517
518        #[cfg(feature = "Bluetooth")]
519        #[deprecated]
520        #[unsafe(method(getClassOfDevice))]
521        #[unsafe(method_family = none)]
522        pub unsafe fn getClassOfDevice(&self) -> BluetoothClassOfDevice;
523
524        #[cfg(feature = "Bluetooth")]
525        /// Get the major service class of the device.
526        ///
527        /// This value is only meaningful if the target device has been seen during an inquiry.  This can be
528        /// by checking the result of -getLastInquiryUpdate.  If nil is returned, then the device hasn't been
529        /// seen.
530        ///
531        /// Returns: Returns the major service class of the device.
532        #[unsafe(method(serviceClassMajor))]
533        #[unsafe(method_family = none)]
534        pub unsafe fn serviceClassMajor(&self) -> BluetoothServiceClassMajor;
535
536        #[cfg(feature = "Bluetooth")]
537        #[deprecated]
538        #[unsafe(method(getServiceClassMajor))]
539        #[unsafe(method_family = none)]
540        pub unsafe fn getServiceClassMajor(&self) -> BluetoothServiceClassMajor;
541
542        #[cfg(feature = "Bluetooth")]
543        /// Get the major device class of the device.
544        ///
545        /// This value is only meaningful if the target device has been seen during an inquiry.  This can be
546        /// by checking the result of -getLastInquiryUpdate.  If nil is returned, then the device hasn't been
547        /// seen.
548        ///
549        /// Returns: Returns the major device class of the remote device.
550        #[unsafe(method(deviceClassMajor))]
551        #[unsafe(method_family = none)]
552        pub unsafe fn deviceClassMajor(&self) -> BluetoothDeviceClassMajor;
553
554        #[cfg(feature = "Bluetooth")]
555        #[deprecated]
556        #[unsafe(method(getDeviceClassMajor))]
557        #[unsafe(method_family = none)]
558        pub unsafe fn getDeviceClassMajor(&self) -> BluetoothDeviceClassMajor;
559
560        #[cfg(feature = "Bluetooth")]
561        /// Get the minor service class of the device.
562        ///
563        /// This value is only meaningful if the target device has been seen during an inquiry.  This can be
564        /// by checking the result of -getLastInquiryUpdate.  If nil is returned, then the device hasn't been
565        /// seen.
566        ///
567        /// Returns: Returns the minor device class of the remote device.
568        #[unsafe(method(deviceClassMinor))]
569        #[unsafe(method_family = none)]
570        pub unsafe fn deviceClassMinor(&self) -> BluetoothDeviceClassMinor;
571
572        #[cfg(feature = "Bluetooth")]
573        #[deprecated]
574        #[unsafe(method(getDeviceClassMinor))]
575        #[unsafe(method_family = none)]
576        pub unsafe fn getDeviceClassMinor(&self) -> BluetoothDeviceClassMinor;
577
578        #[cfg(feature = "objc2-foundation")]
579        /// Get the human readable name of the remote device.
580        ///
581        /// This only returns a value if a remote name request has been performed on the target device.  If a
582        /// successful remote name request has not been completed, nil is returned.  To perform a remote
583        /// name request, call -remoteNameRequest.  If a remote name request has been successfully completed,
584        /// the method -getLastNameUpdate will return the date/time of the last successful request.
585        ///
586        /// Returns: Returns the name of the remote device name.  This value is an NSString generated from the UTF-8
587        /// format of the most recent remote name request.
588        #[unsafe(method(name))]
589        #[unsafe(method_family = none)]
590        pub unsafe fn name(&self) -> Retained<NSString>;
591
592        #[cfg(feature = "objc2-foundation")]
593        #[deprecated]
594        #[unsafe(method(getName))]
595        #[unsafe(method_family = none)]
596        pub unsafe fn getName(&self) -> Option<Retained<NSString>>;
597
598        #[cfg(feature = "objc2-foundation")]
599        /// Get the human readable name of the remote device.  If the name is not present, it will return a string
600        /// containing the device's address.
601        ///
602        /// If a remote name request has been successfully completed, the device name will be returned.  If not,
603        /// a string containg the device address in the format of "XX-XX-XX-XX-XX-XX" will be returned.
604        ///
605        /// Returns: Returns the device's name or a string containing the device's address.
606        #[unsafe(method(nameOrAddress))]
607        #[unsafe(method_family = none)]
608        pub unsafe fn nameOrAddress(&self) -> Option<Retained<NSString>>;
609
610        #[cfg(feature = "objc2-foundation")]
611        #[deprecated]
612        #[unsafe(method(getNameOrAddress))]
613        #[unsafe(method_family = none)]
614        pub unsafe fn getNameOrAddress(&self) -> Option<Retained<NSString>>;
615
616        #[cfg(feature = "objc2-foundation")]
617        /// Get the date/time of the last successful remote name request.
618        ///
619        /// Returns: Returns the date/time of the last successful remote name request.  If no remote name request has been
620        /// completed on the target device, nil is returned.
621        #[unsafe(method(lastNameUpdate))]
622        #[unsafe(method_family = none)]
623        pub unsafe fn lastNameUpdate(&self) -> Retained<NSDate>;
624
625        #[cfg(feature = "objc2-foundation")]
626        #[deprecated]
627        #[unsafe(method(getLastNameUpdate))]
628        #[unsafe(method_family = none)]
629        pub unsafe fn getLastNameUpdate(&self) -> Option<Retained<NSDate>>;
630
631        #[cfg(feature = "Bluetooth")]
632        /// Get the Bluetooth device address for the target device.
633        ///
634        /// Returns: Returns a pointer to the Bluetooth device address of the target device.
635        #[unsafe(method(getAddress))]
636        #[unsafe(method_family = none)]
637        pub unsafe fn getAddress(&self) -> *const BluetoothDeviceAddress;
638
639        #[cfg(feature = "objc2-foundation")]
640        /// Get a string representation of the Bluetooth device address for the target device.  The
641        /// format of the string is the same as returned by IOBluetoothNSStringFromDeviceAddress(void).
642        ///
643        /// NOTE: This method is only available in Mac OS X 10.2.4 (Bluetooth v1.1) or later.
644        ///
645        /// Returns: Returns an NSString containing the Bluetooth device address of the target device.
646        #[unsafe(method(addressString))]
647        #[unsafe(method_family = none)]
648        pub unsafe fn addressString(&self) -> Option<Retained<NSString>>;
649
650        #[cfg(feature = "objc2-foundation")]
651        #[deprecated]
652        #[unsafe(method(getAddressString))]
653        #[unsafe(method_family = none)]
654        pub unsafe fn getAddressString(&self) -> Option<Retained<NSString>>;
655
656        #[cfg(feature = "Bluetooth")]
657        /// Get the value of the page scan repetition mode for the device.
658        ///
659        /// This value is only meaningful if the target device has been seen during an inquiry.  This can be
660        /// by checking the result of -getLastInquiryUpdate.  If nil is returned, then the device hasn't been
661        /// seen.
662        ///
663        /// Returns: Returns the page scan repetition mode value for this device.
664        #[unsafe(method(getPageScanRepetitionMode))]
665        #[unsafe(method_family = none)]
666        pub unsafe fn getPageScanRepetitionMode(&self) -> BluetoothPageScanRepetitionMode;
667
668        #[cfg(feature = "Bluetooth")]
669        /// Get the value of the page scan period mode for the device.
670        ///
671        /// This value is only meaningful if the target device has been seen during an inquiry.  This can be
672        /// by checking the result of -getLastInquiryUpdate.  If nil is returned, then the device hasn't been
673        /// seen.
674        ///
675        /// Returns: Returns page scan period mode value for the device.
676        #[unsafe(method(getPageScanPeriodMode))]
677        #[unsafe(method_family = none)]
678        pub unsafe fn getPageScanPeriodMode(&self) -> BluetoothPageScanPeriodMode;
679
680        #[cfg(feature = "Bluetooth")]
681        /// Get the page scan mode for the device.
682        ///
683        /// This value is only meaningful if the target device has been seen during an inquiry.  This can be
684        /// by checking the result of -getLastInquiryUpdate.  If nil is returned, then the device hasn't been
685        /// seen.
686        ///
687        /// Returns: Returns the value for the page scan mode for the device.
688        #[unsafe(method(getPageScanMode))]
689        #[unsafe(method_family = none)]
690        pub unsafe fn getPageScanMode(&self) -> BluetoothPageScanMode;
691
692        #[cfg(feature = "Bluetooth")]
693        /// Get the clock offset value of the device.
694        ///
695        /// This value is only meaningful if the target device has been seen during an inquiry.  This can be
696        /// by checking the result of -getLastInquiryUpdate.  If nil is returned, then the device hasn't been
697        /// seen.
698        ///
699        /// Returns: Returns the clock offset value for the device.
700        #[unsafe(method(getClockOffset))]
701        #[unsafe(method_family = none)]
702        pub unsafe fn getClockOffset(&self) -> BluetoothClockOffset;
703
704        #[cfg(feature = "objc2-foundation")]
705        /// Get the date/time of the last time the device was returned during an inquiry.
706        ///
707        /// Returns: Returns the date/time of the last time the device was seen during an inquiry.
708        /// If the device has never been seen during an inquiry, nil is returned.
709        #[unsafe(method(getLastInquiryUpdate))]
710        #[unsafe(method_family = none)]
711        pub unsafe fn getLastInquiryUpdate(&self) -> Option<Retained<NSDate>>;
712
713        #[cfg(feature = "Bluetooth")]
714        /// Get the RSSI device (if connected), above or below the golden range. If the RSSI is within the golden
715        /// range, a value of 0 is returned. For the actual RSSI value, use getRawRSSI. For more information, see
716        /// the Bluetooth 4.0 Core Specification.
717        ///
718        /// Returns: Returns the RSSI of the device. If the value cannot be read (e.g. the device is disconnected), a value
719        /// of +127 will be returned.
720        #[unsafe(method(RSSI))]
721        #[unsafe(method_family = none)]
722        pub unsafe fn RSSI(&self) -> BluetoothHCIRSSIValue;
723
724        #[cfg(feature = "Bluetooth")]
725        /// Get the raw RSSI device (if connected).
726        ///
727        /// Returns: Returns the raw RSSI of the device.
728        ///
729        /// This value is the perceived RSSI value, not relative the the golden range (see getRSSI for that value).
730        /// This value will not available on all Bluetooth modules. If the value cannot be read (e.g. the device
731        /// is disconnected) or is not available on a module, a value of +127 will be returned.
732        #[unsafe(method(rawRSSI))]
733        #[unsafe(method_family = none)]
734        pub unsafe fn rawRSSI(&self) -> BluetoothHCIRSSIValue;
735
736        /// Indicates whether a baseband connection to the device exists.
737        ///
738        /// Returns: Returns YES if a baseband connection to the device exists.
739        #[unsafe(method(isConnected))]
740        #[unsafe(method_family = none)]
741        pub unsafe fn isConnected(&self) -> bool;
742
743        /// Create a baseband connection to the device.
744        ///
745        /// This method is synchronous and will not return until either a connection has been established
746        /// or the create connection has failed (perhaps timed out).  This method does the same thing as
747        /// calling -openConnection: with a nil target.     This call with proceed without authentication required, and
748        /// using the default page timeout value.  If authentication or a non-default page timeout is required the method
749        /// -openConnection:withPageTimeout:authenticationRequired: should be used instead.
750        ///
751        /// As of Mac OS X 10.7, this method will no longer mask out "Connection Exists" 'errors' with a success result code;
752        /// your code must account for the cases where the baseband connection is already open.
753        ///
754        ///
755        /// Returns: Returns kIOReturnSuccess if the connection was successfully created.
756        #[unsafe(method(openConnection))]
757        #[unsafe(method_family = none)]
758        pub unsafe fn openConnection(&self) -> IOReturn;
759
760        /// Create a baseband connection to the device.
761        ///
762        /// If a target is specified, the open connection call is asynchronous and on completion of the
763        /// CREATE_CONNECTION command, the method -connectionComplete:status: will be called on the specified target.
764        /// If no target is specified, the call is synchronous and will not return until the connection is open
765        /// or the CREATE_CONNECTION call has failed.  This call with proceed without authentication required, and
766        /// using the default page timeout value.  If authentication or a non-default page timeout is required the method
767        /// -openConnection:withPageTimeout:authenticationRequired: should be used instead.
768        ///
769        /// As of Mac OS X 10.7, this method will no longer mask out "Connection Exists" 'errors' with a success result code;
770        /// your code must account for the cases where the baseband connection is already open.
771        ///
772        ///
773        /// Returns: Returns kIOReturnSuccess if the connection was successfully created (or if asynchronous, if the
774        /// CREATE_CONNECTION command was successfully issued).
775        ///
776        /// # Safety
777        ///
778        /// - `target` should be of the correct type.
779        /// - `target` might not allow `None`.
780        #[unsafe(method(openConnection:))]
781        #[unsafe(method_family = none)]
782        pub unsafe fn openConnection_(&self, target: Option<&AnyObject>) -> IOReturn;
783
784        #[cfg(feature = "Bluetooth")]
785        /// Create a baseband connection to the device.
786        ///
787        /// If a target is specified, the open connection call is asynchronous and on completion of the
788        /// CREATE_CONNECTION command, the method -connectionComplete:status: will be called on the specified target.
789        /// If no target is specified, the call is synchronous and will not return until the connection is open
790        /// or the CREATE_CONNECTION call has failed.
791        ///
792        /// NOTE: This method is only available in Mac OS X 10.2.7 (Bluetooth v1.3) or later.
793        ///
794        /// As of Mac OS X 10.7, this method will no longer mask out "Connection Exists" 'errors' with a success result code;
795        /// your code must account for the cases where the baseband connection is already open.
796        ///
797        ///
798        /// Parameter `target`: The target to message when the create connection call is complete
799        ///
800        /// Parameter `pageTimeoutValue`: The page timeout value to use for this call
801        ///
802        /// Parameter `authenticationRequired`: BOOL value to indicate whether authentication should be required for the connection
803        ///
804        /// Returns: Returns kIOReturnSuccess if the connection was successfully created (or if asynchronous, if the
805        /// CREATE_CONNECTION command was successfully issued).
806        ///
807        /// # Safety
808        ///
809        /// - `target` should be of the correct type.
810        /// - `target` might not allow `None`.
811        #[unsafe(method(openConnection:withPageTimeout:authenticationRequired:))]
812        #[unsafe(method_family = none)]
813        pub unsafe fn openConnection_withPageTimeout_authenticationRequired(
814            &self,
815            target: Option<&AnyObject>,
816            page_timeout_value: BluetoothHCIPageTimeout,
817            authentication_required: bool,
818        ) -> IOReturn;
819
820        /// Close down the baseband connection to the device.
821        ///
822        /// This method is synchronous and will not return until the connection has been closed (or the
823        /// command failed).  In the future this API will be changed to allow asynchronous operation.
824        ///
825        /// Returns: Returns kIOReturnSuccess if the connection has successfully been closed.
826        #[unsafe(method(closeConnection))]
827        #[unsafe(method_family = none)]
828        pub unsafe fn closeConnection(&self) -> IOReturn;
829
830        /// Issues a remote name request to the target device.
831        ///
832        /// If a target is specified, the request is asynchronous and on completion of the request, the method
833        ///
834        /// - (void)remoteNameRequestComplete:(IOBluetoothDevice *)device status:(IOReturn)status;
835        ///
836        /// will be called on the specified target. If no target is specified, the request is made synchronously
837        /// and won't return until the request is complete.  This call with operate with the default page
838        /// timeout value. If a different page timeout value is desired, the method -remoteNameRequest:withPageTimeout:
839        /// should be used instead.
840        ///
841        /// Parameter `target`: The target to message when the remote name request is complete
842        ///
843        /// Returns: Returns kIOReturnSuccess if the remote name request was successfully issued (and if synchronous, if
844        /// the request completed successfully).
845        ///
846        /// # Safety
847        ///
848        /// - `target` should be of the correct type.
849        /// - `target` might not allow `None`.
850        #[unsafe(method(remoteNameRequest:))]
851        #[unsafe(method_family = none)]
852        pub unsafe fn remoteNameRequest(&self, target: Option<&AnyObject>) -> IOReturn;
853
854        #[cfg(feature = "Bluetooth")]
855        /// Issues a remote name request to the target device.
856        ///
857        /// If a target is specified, the request is asynchronous and on completion of the REMOTE_NAME_REQUEST
858        /// command, the method -remoteNameRequestComplete:status:name: will be called on the specified target.
859        /// If no target is specified, the request is made synchronously and won't return until the request is
860        /// complete.
861        ///
862        /// NOTE: This method is only available in Mac OS X 10.2.7 (Bluetooth v1.3) or later.
863        ///
864        /// Parameter `target`: The target to message when the remote name request is complete
865        ///
866        /// Parameter `pageTimeoutValue`: The page timeout value to use for this call
867        ///
868        /// Returns: Returns kIOReturnSuccess if the remote name request was successfully issued (and if synchronous, if
869        /// the request completed successfully).
870        ///
871        /// # Safety
872        ///
873        /// - `target` should be of the correct type.
874        /// - `target` might not allow `None`.
875        #[unsafe(method(remoteNameRequest:withPageTimeout:))]
876        #[unsafe(method_family = none)]
877        pub unsafe fn remoteNameRequest_withPageTimeout(
878            &self,
879            target: Option<&AnyObject>,
880            page_timeout_value: BluetoothHCIPageTimeout,
881        ) -> IOReturn;
882
883        /// Requests that the existing baseband connection be authenticated.
884        ///
885        /// In order to authenticate a baseband connection, a link key needs to be generated as a result of
886        /// the pairing process.  This call will synchronously initiate the pairing process with the target device
887        /// and not return until the authentication process is complete.  This API will be updated to allow
888        /// for asynchronous operation.
889        ///
890        /// Returns: Returns kIOReturnSuccess if the connection has been successfully been authenticated.  Returns an error
891        /// if authentication fails or no baseband connection exists.
892        #[unsafe(method(requestAuthentication))]
893        #[unsafe(method_family = none)]
894        pub unsafe fn requestAuthentication(&self) -> IOReturn;
895
896        #[cfg(feature = "Bluetooth")]
897        /// Get the connection handle for the baseband connection.
898        ///
899        /// This method only returns a valid result if a baseband connection is present (-isConnected returns TRUE).
900        ///
901        /// Returns: Returns the connection handle for the baseband connection.  If no baseband connection is present,
902        /// kBluetoothConnectionHandleNone is returned.
903        #[unsafe(method(connectionHandle))]
904        #[unsafe(method_family = none)]
905        pub unsafe fn connectionHandle(&self) -> BluetoothConnectionHandle;
906
907        #[cfg(feature = "Bluetooth")]
908        #[deprecated]
909        #[unsafe(method(getConnectionHandle))]
910        #[unsafe(method_family = none)]
911        pub unsafe fn getConnectionHandle(&self) -> BluetoothConnectionHandle;
912
913        /// Returns TRUE if the device connection was generated by the remote host.
914        ///
915        /// Returns TRUE if the device connection was generated by the remote host. False if the connection was generated by some other device that connected to the local host.
916        ///
917        /// NOTE: This method is only available in Mac OS X 10.2.7 (Bluetooth v1.3) or later.
918        ///
919        /// Returns: Returns TRUE if the device connection was generated by the remote host.
920        #[unsafe(method(isIncoming))]
921        #[unsafe(method_family = none)]
922        pub unsafe fn isIncoming(&self) -> bool;
923
924        #[cfg(feature = "Bluetooth")]
925        /// Get the link type for the baseband connection.
926        ///
927        /// This method only returns a valid result if a baseband connection is present (-isConnected returns TRUE).
928        ///
929        /// Returns: Returns the link type for the baseband connection.  If no baseband connection is present,
930        /// kBluetoothLinkTypeNone is returned.
931        #[unsafe(method(getLinkType))]
932        #[unsafe(method_family = none)]
933        pub unsafe fn getLinkType(&self) -> BluetoothLinkType;
934
935        #[cfg(feature = "Bluetooth")]
936        /// Get the encryption mode for the baseband connection.
937        ///
938        /// This method only returns a valid result if a baseband connection is present (-isConnected returns TRUE).
939        ///
940        /// Returns: Returns the encryption mode for the baseband connection.  If no baseband connection is present,
941        /// kEncryptionDisabled is returned.
942        #[unsafe(method(getEncryptionMode))]
943        #[unsafe(method_family = none)]
944        pub unsafe fn getEncryptionMode(&self) -> BluetoothHCIEncryptionMode;
945
946        /// Performs an SDP query on the target device.
947        ///
948        /// As a result of this call, a baseband connection will be built to the device (if not already connected).
949        /// Then, an L2CAP channel will be opened to the SDP server on the device.  At that point, a Service
950        /// Search Attribute request will be issued with a UUID of 0x0100 (L2CAP) and an attribute range of
951        /// 0x0000 - 0xffff specified.  This will cause the SDP server to return all attributes of all L2CAP-derived
952        /// services on the device.  The results essentially encompass all services on the device.
953        /// This function is always asynchronous.  If a target is specified, when the SDP query is complete (or
954        /// an error is encountered), the method -sdpQueryComplete:status: will be called on the given target.  If no target
955        /// is specified, the request is still asynchronous, but no callback will be made.  That can be useful if the client
956        /// has    registered for SDP service changed notifications.
957        ///
958        /// Parameter `target`: The target to message when the SDP query is complete
959        ///
960        /// Returns: Returns kIOReturnSuccess if the SDP query was successfully started.
961        ///
962        /// # Safety
963        ///
964        /// - `target` should be of the correct type.
965        /// - `target` might not allow `None`.
966        #[unsafe(method(performSDPQuery:))]
967        #[unsafe(method_family = none)]
968        pub unsafe fn performSDPQuery(&self, target: Option<&AnyObject>) -> IOReturn;
969
970        #[cfg(feature = "objc2-foundation")]
971        /// Performs an SDP query on the target device with the specified service UUIDs.
972        ///
973        /// As a result of this call, a baseband connection will be built to the device (if not already connected).
974        /// Then, an L2CAP channel will be opened to the SDP server on the device.  At that point, a Service
975        /// Search Attribute request will be issued for each service UUID specified in the UUID array.
976        ///
977        /// This function is always asynchronous.  If a target is specified, when the SDP query is complete (or
978        /// an error is encountered), the method -sdpQueryComplete:status: will be called on the given target.  If no target
979        /// is specified, the request is still asynchronous, but no callback will be made.  That can be useful if the client
980        /// has    registered for SDP service changed notifications.
981        ///
982        /// Parameter `target`: The target to message when the SDP query is complete
983        ///
984        /// Parameter `uuidArray`: An array of IOBluetoothSDPUUID objects for each service the caller is interested in
985        ///
986        ///
987        /// Returns: Returns kIOReturnSuccess if the SDP query was successfully started.
988        ///
989        /// # Safety
990        ///
991        /// - `target` should be of the correct type.
992        /// - `target` might not allow `None`.
993        /// - `uuid_array` generic should be of the correct type.
994        /// - `uuid_array` might not allow `None`.
995        #[unsafe(method(performSDPQuery:uuids:))]
996        #[unsafe(method_family = none)]
997        pub unsafe fn performSDPQuery_uuids(
998            &self,
999            target: Option<&AnyObject>,
1000            uuid_array: Option<&NSArray>,
1001        ) -> IOReturn;
1002
1003        #[cfg(feature = "objc2-foundation")]
1004        /// Gets an array of service records for the device.
1005        ///
1006        /// The resulting array contains IOBluetoothSDPServiceRecord objects.  The service records are only
1007        /// present if an SDP query has been done on the target object.  This can be determined by calling
1008        /// -getLastServicesUpdate.  It will return the last date/time of the SDP query. To initiate an
1009        /// SDP query on a device, use -performSDPQuery: as defined above.
1010        ///
1011        /// Instead of allowing individual clients to query for different services and service attributes,
1012        /// the system request all of the device's services and service attributes.
1013        ///
1014        /// Returns: Returns an array of service records for the device if an SDP query has been performed.  If no
1015        /// SDP query has been performed, nil is returned.
1016        #[unsafe(method(services))]
1017        #[unsafe(method_family = none)]
1018        pub unsafe fn services(&self) -> Option<Retained<NSArray>>;
1019
1020        #[cfg(feature = "objc2-foundation")]
1021        #[deprecated]
1022        #[unsafe(method(getServices))]
1023        #[unsafe(method_family = none)]
1024        pub unsafe fn getServices(&self) -> Option<Retained<NSArray>>;
1025
1026        #[cfg(feature = "objc2-foundation")]
1027        /// Get the date/time of the last SDP query.
1028        ///
1029        /// Returns: Returns the date/time of the last SDP query.  If an SDP query has never been performed on the
1030        /// device, nil is returned.
1031        #[unsafe(method(getLastServicesUpdate))]
1032        #[unsafe(method_family = none)]
1033        pub unsafe fn getLastServicesUpdate(&self) -> Option<Retained<NSDate>>;
1034
1035        #[cfg(all(
1036            feature = "IOBluetoothSDPServiceRecord",
1037            feature = "IOBluetoothSDPUUID",
1038            feature = "objc2-foundation"
1039        ))]
1040        /// Search for a service record containing the given UUID.
1041        ///
1042        /// This method searches through the device's services to find a service that contains the given
1043        /// UUID.  Only the first service record will be returned.  This method only operates on services
1044        /// that have already been queried.  It will not initiate a new query.  This method should probably
1045        /// be updated to return an array of service records if more than one contains the UUID.
1046        ///
1047        /// Parameter `sdpUUID`: UUID value to search for.
1048        ///
1049        /// Returns: Returns the first service record that contains the given uuid.  If no service record is found,
1050        /// nil is returned.
1051        ///
1052        /// # Safety
1053        ///
1054        /// `sdp_uuid` might not allow `None`.
1055        #[unsafe(method(getServiceRecordForUUID:))]
1056        #[unsafe(method_family = none)]
1057        pub unsafe fn getServiceRecordForUUID(
1058            &self,
1059            sdp_uuid: Option<&IOBluetoothSDPUUID>,
1060        ) -> Option<Retained<IOBluetoothSDPServiceRecord>>;
1061
1062        #[cfg(feature = "objc2-foundation")]
1063        /// Gets an array of the user's favorite devices.
1064        ///
1065        /// The resulting array contains IOBluetoothDevice objects.
1066        ///
1067        /// NOTE: This method is only available in Mac OS X 10.2.4 (Bluetooth v1.1) or later.
1068        ///
1069        /// Returns: Returns an array of device objects representing the user's favorite devices.  If the
1070        /// user has no favorites, nil is returned.
1071        #[unsafe(method(favoriteDevices))]
1072        #[unsafe(method_family = none)]
1073        pub unsafe fn favoriteDevices() -> Option<Retained<NSArray>>;
1074
1075        /// Reports whether the target device is a favorite for the user.
1076        ///
1077        /// NOTE: This method is only available in Mac OS X 10.2.4 (Bluetooth v1.1) or later.
1078        ///
1079        /// Returns: Returns TRUE if the target device is a favorite for the user, FALSE if not.
1080        #[unsafe(method(isFavorite))]
1081        #[unsafe(method_family = none)]
1082        pub unsafe fn isFavorite(&self) -> bool;
1083
1084        /// Adds the target device to the user's favorite devices list.
1085        ///
1086        /// NOTE: This method is only available in Mac OS X 10.2.4 (Bluetooth v1.1) or later.
1087        ///
1088        /// Returns: Returns kIOReturnSuccess if the device was successfully added to the user's
1089        /// list of favorite devices.
1090        #[unsafe(method(addToFavorites))]
1091        #[unsafe(method_family = none)]
1092        pub unsafe fn addToFavorites(&self) -> IOReturn;
1093
1094        /// Removes the target device from the user's favorite devices list.
1095        ///
1096        /// NOTE: This method is only available in Mac OS X 10.2.4 (Bluetooth v1.1) or later.
1097        ///
1098        /// Returns: Returns kIOReturnSuccess if the device was successfully removed from the user's
1099        /// list of favorite devices.
1100        #[unsafe(method(removeFromFavorites))]
1101        #[unsafe(method_family = none)]
1102        pub unsafe fn removeFromFavorites(&self) -> IOReturn;
1103
1104        #[cfg(feature = "objc2-foundation")]
1105        /// Gets an array of recently used Bluetooth devices.
1106        ///
1107        /// The resulting array contains IOBluetoothDevice objects sorted in reverse chronological order.
1108        /// The most recently accessed devices are first.  If the numDevices parameter is 0, all devices
1109        /// accessed by the system are returned.  If numDevices is non-zero, only the most recent devices
1110        /// are returned.
1111        ///
1112        /// NOTE: This method is only available in Mac OS X 10.2.4 (Bluetooth v1.1) or later.
1113        ///
1114        /// Parameter `numDevices`: The number of devices to return.
1115        ///
1116        /// Returns: Returns an array of device objects recently used by the system.  If no devices have been accessed,
1117        /// nil is returned.
1118        #[unsafe(method(recentDevices:))]
1119        #[unsafe(method_family = none)]
1120        pub unsafe fn recentDevices(num_devices: c_ulong) -> Option<Retained<NSArray>>;
1121
1122        #[cfg(feature = "objc2-foundation")]
1123        /// Returns the date/time of the most recent access of the target device.
1124        ///
1125        /// This is the date that -recentDevices uses to sort its list of the most recently accessed
1126        /// devices.
1127        ///
1128        /// NOTE: This method is only available in Mac OS X 10.2.4 (Bluetooth v1.1) or later.
1129        ///
1130        /// Returns: Returns the date/time of the most recent access of the target device.  If the device
1131        /// has not been accessed, nil is returned.
1132        #[unsafe(method(recentAccessDate))]
1133        #[unsafe(method_family = none)]
1134        pub unsafe fn recentAccessDate(&self) -> Option<Retained<NSDate>>;
1135
1136        #[cfg(feature = "objc2-foundation")]
1137        /// Gets an array of all of the paired devices on the system.
1138        ///
1139        /// The resulting array contains IOBluetoothDevice objects.  The paired devices are currently NOT stored
1140        /// per user, so this is all devices paired by any user.
1141        ///
1142        /// NOTE: This method is only available in Mac OS X 10.2.5 (Bluetooth v1.2) or later.
1143        ///
1144        /// Returns: Returns an array of device objects for all of the paired devices on the system.  If there are
1145        /// no paired devices, nil is returned.
1146        #[unsafe(method(pairedDevices))]
1147        #[unsafe(method_family = none)]
1148        pub unsafe fn pairedDevices() -> Option<Retained<NSArray>>;
1149
1150        /// Returns whether the target device is paired.
1151        ///
1152        /// NOTE: This method is only available in Mac OS X 10.2.5 (Bluetooth v1.2) or later.
1153        ///
1154        /// Returns: Returns TRUE if the target device is paired, FALSE if not.
1155        #[unsafe(method(isPaired))]
1156        #[unsafe(method_family = none)]
1157        pub unsafe fn isPaired(&self) -> bool;
1158
1159        /// Sets the connection supervision timeout.
1160        ///
1161        /// NOTE: This method is only available in Mac OS X 10.5 (Bluetooth v2.0) or later.
1162        ///
1163        /// Parameter `timeout`: A client-supplied link supervision timeout value to use to monitor the connection. The timeout
1164        /// value should be specified in slots, so you can use the BluetoothGetSlotsFromSeconds macro to get the proper
1165        /// value. e.g. BluetoothGetSlotsFromSeconds( 5.0 ) will give yield the proper number of slots (8000) for 5 seconds.
1166        ///
1167        /// Returns: Returns kIOReturnSuccess if it was possible to set the connection supervision timeout.
1168        #[unsafe(method(setSupervisionTimeout:))]
1169        #[unsafe(method_family = none)]
1170        pub unsafe fn setSupervisionTimeout(&self, timeout: u16) -> IOReturn;
1171
1172        #[cfg(all(
1173            feature = "Bluetooth",
1174            feature = "IOBluetoothL2CAPChannel",
1175            feature = "objc2-foundation"
1176        ))]
1177        /// Opens a new L2CAP channel to the target device. Returns only after the channel is opened.
1178        ///
1179        /// This method will begin the process of opening a new L2CAP channel to the target device.
1180        /// The baseband connection to the device will be opened if it is not open already.  The L2CAP
1181        /// channel open process will not complete until the client has registered an incoming data
1182        /// listener on the new channel.  This prevents a situation where the channel succeeds
1183        /// in being configured and opened and receives data before the client is listening and
1184        /// is ready for it. The L2CAP channel object is already retained when this function returns success;
1185        /// the channel must be released when the caller is done with it.
1186        ///
1187        /// NOTE: This method is only available in Mac OS X 10.5 (Bluetooth v2.0) or later.
1188        ///
1189        /// Parameter `newChannel`: A pointer to an IOBluetoothL2CAPChannel object to receive the L2CAP channel
1190        /// requested to be opened.  The newChannel pointer will only be set if
1191        /// kIOReturnSuccess is returned.
1192        ///
1193        /// Parameter `withPSM`: The L2CAP PSM value for the new channel.
1194        ///
1195        /// Parameter `channelConfiguration`: the dictionary that describes the initial configuration for
1196        /// the channel.
1197        ///
1198        /// Parameter `channelDelegate`: the object that will play the role of delegate for the channel.
1199        /// A channel delegate is the object the l2cap uses as target for  data and events. The
1200        /// developer will implement only the the methods he/she is interested in. A list of the
1201        /// possible methods is at the end of the file "IOBluetoothL2CAPChannel.h" in the definition
1202        /// of the protocol IOBluetoothL2CAPChannelDelegate.
1203        ///
1204        ///
1205        /// Returns: Returns kIOReturnSuccess if the open process was successfully started (or if an existing
1206        /// L2CAP channel was found). The channel must be released when the caller is done with it.
1207        ///
1208        /// # Safety
1209        ///
1210        /// - `new_channel` might not allow `None`.
1211        /// - `channel_configuration` generic should be of the correct type.
1212        /// - `channel_configuration` might not allow `None`.
1213        /// - `channel_delegate` should be of the correct type.
1214        /// - `channel_delegate` might not allow `None`.
1215        #[unsafe(method(openL2CAPChannelSync:withPSM:withConfiguration:delegate:))]
1216        #[unsafe(method_family = none)]
1217        pub unsafe fn openL2CAPChannelSync_withPSM_withConfiguration_delegate(
1218            &self,
1219            new_channel: Option<&mut Option<Retained<IOBluetoothL2CAPChannel>>>,
1220            psm: BluetoothL2CAPPSM,
1221            channel_configuration: Option<&NSDictionary>,
1222            channel_delegate: Option<&AnyObject>,
1223        ) -> IOReturn;
1224
1225        #[cfg(all(
1226            feature = "Bluetooth",
1227            feature = "IOBluetoothL2CAPChannel",
1228            feature = "objc2-foundation"
1229        ))]
1230        /// Opens a new L2CAP channel to the target device. Returns immediately after starting the opening process.
1231        ///
1232        /// This method will begin the process of opening a new L2CAP channel to the target device.
1233        /// The baseband connection to the device will be opened if it is not open already.  The L2CAP
1234        /// channel open process will not complete until the client has registered an incoming data
1235        /// listener on the new channel.  This prevents a situation where the channel succeeds
1236        /// in being configured and opened and receives data before the client is listening and
1237        /// is ready for it. The L2CAP channel object is already retained when this function returns success;
1238        /// the channel must be released when the caller is done with it.
1239        ///
1240        /// NOTE: This method is only available in Mac OS X 10.5 (Bluetooth v2.0) or later.
1241        ///
1242        /// Parameter `newChannel`: A pointer to an IOBluetoothL2CAPChannel object to receive the L2CAP channel
1243        /// requested to be opened.  The newChannel pointer will only be set if
1244        /// kIOReturnSuccess is returned.
1245        ///
1246        /// Parameter `psm`: The L2CAP PSM value for the new channel.
1247        ///
1248        /// Parameter `channelConfiguration`: the dictionary that describes the initial configuration for
1249        /// the channel.
1250        ///
1251        /// Parameter `channelDelegate`: the object that will play the role of delegate for the channel.
1252        /// A channel delegate is the object the l2cap uses as target for  data and events. The
1253        /// developer will implement only the the methods he/she is interested in. A list of the
1254        /// possible methods is at the end of the file "IOBluetoothL2CAPChannel.h" in the definition
1255        /// of the protocol IOBluetoothL2CAPChannelDelegate.
1256        ///
1257        ///
1258        /// Returns: Returns kIOReturnSuccess if the open process was successfully started (or if an existing
1259        /// L2CAP channel was found). The channel must be released when the caller is done with it.
1260        ///
1261        /// # Safety
1262        ///
1263        /// - `new_channel` might not allow `None`.
1264        /// - `channel_configuration` generic should be of the correct type.
1265        /// - `channel_configuration` might not allow `None`.
1266        /// - `channel_delegate` should be of the correct type.
1267        /// - `channel_delegate` might not allow `None`.
1268        #[unsafe(method(openL2CAPChannelAsync:withPSM:withConfiguration:delegate:))]
1269        #[unsafe(method_family = none)]
1270        pub unsafe fn openL2CAPChannelAsync_withPSM_withConfiguration_delegate(
1271            &self,
1272            new_channel: Option<&mut Option<Retained<IOBluetoothL2CAPChannel>>>,
1273            psm: BluetoothL2CAPPSM,
1274            channel_configuration: Option<&NSDictionary>,
1275            channel_delegate: Option<&AnyObject>,
1276        ) -> IOReturn;
1277    );
1278}
1279
1280/// Methods declared on superclass `NSObject`.
1281#[cfg(feature = "IOBluetoothObject")]
1282impl IOBluetoothDevice {
1283    extern_methods!(
1284        #[unsafe(method(init))]
1285        #[unsafe(method_family = init)]
1286        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1287
1288        #[unsafe(method(new))]
1289        #[unsafe(method_family = new)]
1290        pub unsafe fn new() -> Retained<Self>;
1291    );
1292}