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