objc2_core_bluetooth/generated/
CBCentralManager.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5#[cfg(feature = "dispatch2")]
6use dispatch2::*;
7use objc2::__framework_prelude::*;
8#[cfg(feature = "objc2-core-foundation")]
9use objc2_core_foundation::*;
10use objc2_foundation::*;
11
12use crate::*;
13
14/// Represents the current state of a CBCentralManager.
15///
16/// See also [Apple's documentation](https://developer.apple.com/documentation/corebluetooth/cbcentralmanagerstate?language=objc)
17// NS_ENUM
18#[deprecated = "Use CBManagerState instead"]
19#[repr(transparent)]
20#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
21pub struct CBCentralManagerState(pub NSInteger);
22impl CBCentralManagerState {
23    #[doc(alias = "CBCentralManagerStateUnknown")]
24    #[cfg(feature = "CBManager")]
25    #[deprecated = "Use CBManagerState instead"]
26    pub const Unknown: Self = Self(CBManagerState::Unknown.0);
27    #[doc(alias = "CBCentralManagerStateResetting")]
28    #[cfg(feature = "CBManager")]
29    #[deprecated = "Use CBManagerState instead"]
30    pub const Resetting: Self = Self(CBManagerState::Resetting.0);
31    #[doc(alias = "CBCentralManagerStateUnsupported")]
32    #[cfg(feature = "CBManager")]
33    #[deprecated = "Use CBManagerState instead"]
34    pub const Unsupported: Self = Self(CBManagerState::Unsupported.0);
35    #[doc(alias = "CBCentralManagerStateUnauthorized")]
36    #[cfg(feature = "CBManager")]
37    #[deprecated = "Use CBManagerState instead"]
38    pub const Unauthorized: Self = Self(CBManagerState::Unauthorized.0);
39    #[doc(alias = "CBCentralManagerStatePoweredOff")]
40    #[cfg(feature = "CBManager")]
41    #[deprecated = "Use CBManagerState instead"]
42    pub const PoweredOff: Self = Self(CBManagerState::PoweredOff.0);
43    #[doc(alias = "CBCentralManagerStatePoweredOn")]
44    #[cfg(feature = "CBManager")]
45    #[deprecated = "Use CBManagerState instead"]
46    pub const PoweredOn: Self = Self(CBManagerState::PoweredOn.0);
47}
48
49unsafe impl Encode for CBCentralManagerState {
50    const ENCODING: Encoding = NSInteger::ENCODING;
51}
52
53unsafe impl RefEncode for CBCentralManagerState {
54    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
55}
56
57/// Represents the connection state of a peer.
58///
59/// See also [Apple's documentation](https://developer.apple.com/documentation/corebluetooth/cbconnectionevent?language=objc)
60// NS_ENUM
61#[repr(transparent)]
62#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
63pub struct CBConnectionEvent(pub NSInteger);
64impl CBConnectionEvent {
65    #[doc(alias = "CBConnectionEventPeerDisconnected")]
66    pub const PeerDisconnected: Self = Self(0);
67    #[doc(alias = "CBConnectionEventPeerConnected")]
68    pub const PeerConnected: Self = Self(1);
69}
70
71unsafe impl Encode for CBConnectionEvent {
72    const ENCODING: Encoding = NSInteger::ENCODING;
73}
74
75unsafe impl RefEncode for CBConnectionEvent {
76    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
77}
78
79/// The set of device specific features.
80///
81/// See also [Apple's documentation](https://developer.apple.com/documentation/corebluetooth/cbcentralmanagerfeature?language=objc)
82// NS_OPTIONS
83#[repr(transparent)]
84#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
85pub struct CBCentralManagerFeature(pub NSUInteger);
86bitflags::bitflags! {
87    impl CBCentralManagerFeature: NSUInteger {
88        #[doc(alias = "CBCentralManagerFeatureExtendedScanAndConnect")]
89        const ExtendedScanAndConnect = 1<<0;
90    }
91}
92
93unsafe impl Encode for CBCentralManagerFeature {
94    const ENCODING: Encoding = NSUInteger::ENCODING;
95}
96
97unsafe impl RefEncode for CBCentralManagerFeature {
98    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
99}
100
101extern_class!(
102    /// Entry point to the central role. Commands should only be issued when its state is
103    /// <code>
104    /// CBCentralManagerStatePoweredOn
105    /// </code>
106    /// .
107    ///
108    /// See also [Apple's documentation](https://developer.apple.com/documentation/corebluetooth/cbcentralmanager?language=objc)
109    #[unsafe(super(CBManager, NSObject))]
110    #[derive(Debug, PartialEq, Eq, Hash)]
111    #[cfg(feature = "CBManager")]
112    pub struct CBCentralManager;
113);
114
115#[cfg(feature = "CBManager")]
116extern_conformance!(
117    unsafe impl NSObjectProtocol for CBCentralManager {}
118);
119
120#[cfg(feature = "CBManager")]
121impl CBCentralManager {
122    extern_methods!(
123        /// The delegate object that will receive central events.
124        #[unsafe(method(delegate))]
125        #[unsafe(method_family = none)]
126        pub unsafe fn delegate(
127            &self,
128        ) -> Option<Retained<ProtocolObject<dyn CBCentralManagerDelegate>>>;
129
130        /// Setter for [`delegate`][Self::delegate].
131        ///
132        /// This is a [weak property][objc2::topics::weak_property].
133        #[unsafe(method(setDelegate:))]
134        #[unsafe(method_family = none)]
135        pub unsafe fn setDelegate(
136            &self,
137            delegate: Option<&ProtocolObject<dyn CBCentralManagerDelegate>>,
138        );
139
140        /// Whether or not the central is currently scanning.
141        #[unsafe(method(isScanning))]
142        #[unsafe(method_family = none)]
143        pub unsafe fn isScanning(&self) -> bool;
144
145        /// Parameter `features`: One or more features you would like to check if supported.
146        ///
147        ///
148        /// Returns a boolean value representing the support for the provided features.
149        #[unsafe(method(supportsFeatures:))]
150        #[unsafe(method_family = none)]
151        pub unsafe fn supportsFeatures(features: CBCentralManagerFeature) -> bool;
152
153        #[unsafe(method(init))]
154        #[unsafe(method_family = init)]
155        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
156
157        #[cfg(feature = "dispatch2")]
158        /// Parameter `delegate`: The delegate that will receive central role events.
159        ///
160        /// Parameter `queue`: The dispatch queue on which the events will be dispatched.
161        ///
162        ///
163        /// The initialization call. The events of the central role will be dispatched on the provided queue.
164        /// If
165        /// <i>
166        /// nil
167        /// </i>
168        /// , the main queue will be used.
169        ///
170        /// # Safety
171        ///
172        /// `queue` possibly has additional threading requirements.
173        #[unsafe(method(initWithDelegate:queue:))]
174        #[unsafe(method_family = init)]
175        pub unsafe fn initWithDelegate_queue(
176            this: Allocated<Self>,
177            delegate: Option<&ProtocolObject<dyn CBCentralManagerDelegate>>,
178            queue: Option<&DispatchQueue>,
179        ) -> Retained<Self>;
180
181        #[cfg(feature = "dispatch2")]
182        /// Parameter `delegate`: The delegate that will receive central role events.
183        ///
184        /// Parameter `queue`: The dispatch queue on which the events will be dispatched.
185        ///
186        /// Parameter `options`: An optional dictionary specifying options for the manager.
187        ///
188        ///
189        /// The initialization call. The events of the central role will be dispatched on the provided queue.
190        /// If
191        /// <i>
192        /// nil
193        /// </i>
194        /// , the main queue will be used.
195        ///
196        ///
197        /// See also: CBCentralManagerOptionShowPowerAlertKey
198        ///
199        /// See also: CBCentralManagerOptionRestoreIdentifierKey
200        ///
201        /// # Safety
202        ///
203        /// - `queue` possibly has additional threading requirements.
204        /// - `options` generic should be of the correct type.
205        #[unsafe(method(initWithDelegate:queue:options:))]
206        #[unsafe(method_family = init)]
207        pub unsafe fn initWithDelegate_queue_options(
208            this: Allocated<Self>,
209            delegate: Option<&ProtocolObject<dyn CBCentralManagerDelegate>>,
210            queue: Option<&DispatchQueue>,
211            options: Option<&NSDictionary<NSString, AnyObject>>,
212        ) -> Retained<Self>;
213
214        #[cfg(all(feature = "CBPeer", feature = "CBPeripheral"))]
215        /// Parameter `identifiers`: A list of
216        /// <code>
217        /// NSUUID
218        /// </code>
219        /// objects.
220        ///
221        ///
222        /// Attempts to retrieve the
223        /// <code>
224        /// CBPeripheral
225        /// </code>
226        /// object(s) with the corresponding
227        /// <i>
228        /// identifiers
229        /// </i>
230        /// .
231        ///
232        ///
233        /// Returns: A list of
234        /// <code>
235        /// CBPeripheral
236        /// </code>
237        /// objects.
238        #[unsafe(method(retrievePeripheralsWithIdentifiers:))]
239        #[unsafe(method_family = none)]
240        pub unsafe fn retrievePeripheralsWithIdentifiers(
241            &self,
242            identifiers: &NSArray<NSUUID>,
243        ) -> Retained<NSArray<CBPeripheral>>;
244
245        #[cfg(all(feature = "CBPeer", feature = "CBPeripheral", feature = "CBUUID"))]
246        /// Retrieves all peripherals that are connected to the system and implement any of the services listed in
247        /// <i>
248        /// serviceUUIDs
249        /// </i>
250        /// .
251        /// Note that this set can include peripherals which were connected by other applications, which will need to be connected locally
252        /// via {
253        ///
254        /// ```text
255        ///  connectPeripheral:options:} before they can be used.
256        ///
257        ///     @return        A list of <code>CBPeripheral</code> objects.
258        ///
259        ///  
260        ///
261        /// ```
262        #[unsafe(method(retrieveConnectedPeripheralsWithServices:))]
263        #[unsafe(method_family = none)]
264        pub unsafe fn retrieveConnectedPeripheralsWithServices(
265            &self,
266            service_uui_ds: &NSArray<CBUUID>,
267        ) -> Retained<NSArray<CBPeripheral>>;
268
269        #[cfg(feature = "CBUUID")]
270        /// Parameter `serviceUUIDs`: A list of
271        /// <code>
272        /// CBUUID
273        /// </code>
274        /// objects representing the service(s) to scan for.
275        ///
276        /// Parameter `options`: An optional dictionary specifying options for the scan.
277        ///
278        ///
279        /// Starts scanning for peripherals that are advertising any of the services listed in
280        /// <i>
281        /// serviceUUIDs
282        /// </i>
283        /// . Although strongly discouraged,
284        /// if
285        /// <i>
286        /// serviceUUIDs
287        /// </i>
288        /// is
289        /// <i>
290        /// nil
291        /// </i>
292        /// all discovered peripherals will be returned. If the central is already scanning with different
293        /// <i>
294        /// serviceUUIDs
295        /// </i>
296        /// or
297        /// <i>
298        /// options
299        /// </i>
300        /// , the provided parameters will replace them.
301        /// Applications that have specified the
302        /// <code>
303        /// bluetooth-central
304        /// </code>
305        /// background mode are allowed to scan while backgrounded, with two
306        /// caveats: the scan must specify one or more service types in
307        /// <i>
308        /// serviceUUIDs
309        /// </i>
310        /// , and the
311        /// <code>
312        /// CBCentralManagerScanOptionAllowDuplicatesKey
313        /// </code>
314        /// scan option will be ignored.
315        ///
316        ///
317        /// See: centralManager:didDiscoverPeripheral:advertisementData:RSSI:
318        ///
319        /// See also: CBCentralManagerScanOptionAllowDuplicatesKey
320        ///
321        /// See also: CBCentralManagerScanOptionSolicitedServiceUUIDsKey
322        ///
323        /// # Safety
324        ///
325        /// `options` generic should be of the correct type.
326        #[unsafe(method(scanForPeripheralsWithServices:options:))]
327        #[unsafe(method_family = none)]
328        pub unsafe fn scanForPeripheralsWithServices_options(
329            &self,
330            service_uui_ds: Option<&NSArray<CBUUID>>,
331            options: Option<&NSDictionary<NSString, AnyObject>>,
332        );
333
334        /// Stops scanning for peripherals.
335        #[unsafe(method(stopScan))]
336        #[unsafe(method_family = none)]
337        pub unsafe fn stopScan(&self);
338
339        #[cfg(all(feature = "CBPeer", feature = "CBPeripheral"))]
340        /// Parameter `peripheral`: The
341        /// <code>
342        /// CBPeripheral
343        /// </code>
344        /// to be connected.
345        ///
346        /// Parameter `options`: An optional dictionary specifying connection behavior options.
347        ///
348        ///
349        /// Initiates a connection to
350        /// <i>
351        /// peripheral
352        /// </i>
353        /// . Connection attempts never time out and, depending on the outcome, will result
354        /// in a call to either {
355        ///
356        /// ```text
357        ///  centralManager:didConnectPeripheral:} or {@link centralManager:didFailToConnectPeripheral:error:}.
358        ///                       Pending attempts are cancelled automatically upon deallocation of <i>peripheral</i>, and explicitly via {@link cancelPeripheralConnection}.
359        ///
360        ///   @see                centralManager:didConnectPeripheral:
361        ///   @see                centralManager:didFailToConnectPeripheral:error:
362        ///   @seealso            CBConnectPeripheralOptionNotifyOnConnectionKey
363        ///   @seealso            CBConnectPeripheralOptionNotifyOnDisconnectionKey
364        ///   @seealso            CBConnectPeripheralOptionNotifyOnNotificationKey
365        ///   @seealso            CBConnectPeripheralOptionEnableTransportBridgingKey
366        ///     @seealso            CBConnectPeripheralOptionRequiresANCS
367        ///   @seealso            CBConnectPeripheralOptionEnableAutoReconnect
368        ///
369        ///  
370        ///
371        /// ```
372        ///
373        /// # Safety
374        ///
375        /// `options` generic should be of the correct type.
376        #[unsafe(method(connectPeripheral:options:))]
377        #[unsafe(method_family = none)]
378        pub unsafe fn connectPeripheral_options(
379            &self,
380            peripheral: &CBPeripheral,
381            options: Option<&NSDictionary<NSString, AnyObject>>,
382        );
383
384        #[cfg(all(feature = "CBPeer", feature = "CBPeripheral"))]
385        /// Parameter `peripheral`: A
386        /// <code>
387        /// CBPeripheral
388        /// </code>
389        /// .
390        ///
391        ///
392        /// Cancels an active or pending connection to
393        /// <i>
394        /// peripheral
395        /// </i>
396        /// . Note that this is non-blocking, and any
397        /// <code>
398        /// CBPeripheral
399        /// </code>
400        /// commands that are still pending to
401        /// <i>
402        /// peripheral
403        /// </i>
404        /// may or may not complete.
405        ///
406        ///
407        /// See: centralManager:didDisconnectPeripheral:error:
408        #[unsafe(method(cancelPeripheralConnection:))]
409        #[unsafe(method_family = none)]
410        pub unsafe fn cancelPeripheralConnection(&self, peripheral: &CBPeripheral);
411
412        #[cfg(feature = "CBCentralManagerConstants")]
413        /// Parameter `options`: A dictionary specifying connection event options.
414        ///
415        ///
416        /// Calls {
417        ///
418        /// ```text
419        ///  centralManager:connectionEventDidOccur:forPeripheral:} when a connection event occurs matching any of the given options.
420        ///                       Passing nil in the option parameter clears any prior registered matching options.
421        ///
422        ///   @see                centralManager:connectionEventDidOccur:forPeripheral:
423        ///   @seealso            CBConnectionEventMatchingOptionServiceUUIDs
424        ///   @seealso            CBConnectionEventMatchingOptionPeripheralUUIDs
425        ///  
426        ///
427        /// ```
428        ///
429        /// # Safety
430        ///
431        /// `options` generic should be of the correct type.
432        #[unsafe(method(registerForConnectionEventsWithOptions:))]
433        #[unsafe(method_family = none)]
434        pub unsafe fn registerForConnectionEventsWithOptions(
435            &self,
436            options: Option<&NSDictionary<CBConnectionEventMatchingOption, AnyObject>>,
437        );
438    );
439}
440
441/// Methods declared on superclass `NSObject`.
442#[cfg(feature = "CBManager")]
443impl CBCentralManager {
444    extern_methods!(
445        #[unsafe(method(new))]
446        #[unsafe(method_family = new)]
447        pub unsafe fn new() -> Retained<Self>;
448    );
449}
450
451extern_protocol!(
452    /// The delegate of a {
453    ///
454    /// ```text
455    ///  CBCentralManager} object must adopt the <code>CBCentralManagerDelegate</code> protocol. The
456    ///               single required method indicates the availability of the central manager, while the optional methods allow for the discovery and
457    ///               connection of peripherals.
458    ///
459    ///  
460    ///
461    /// ```
462    ///
463    /// See also [Apple's documentation](https://developer.apple.com/documentation/corebluetooth/cbcentralmanagerdelegate?language=objc)
464    pub unsafe trait CBCentralManagerDelegate: NSObjectProtocol {
465        #[cfg(feature = "CBManager")]
466        /// Parameter `central`: The central manager whose state has changed.
467        ///
468        ///
469        /// Invoked whenever the central manager's state has been updated. Commands should only be issued when the state is
470        /// <code>
471        /// CBCentralManagerStatePoweredOn
472        /// </code>
473        /// . A state below
474        /// <code>
475        /// CBCentralManagerStatePoweredOn
476        /// </code>
477        /// implies that scanning has stopped and any connected peripherals have been disconnected. If the state moves below
478        /// <code>
479        /// CBCentralManagerStatePoweredOff
480        /// </code>
481        /// , all
482        /// <code>
483        /// CBPeripheral
484        /// </code>
485        /// objects obtained from this central
486        /// manager become invalid and must be retrieved or discovered again.
487        ///
488        ///
489        /// See: state
490        #[unsafe(method(centralManagerDidUpdateState:))]
491        #[unsafe(method_family = none)]
492        unsafe fn centralManagerDidUpdateState(&self, central: &CBCentralManager);
493
494        #[cfg(feature = "CBManager")]
495        /// Parameter `central`: The central manager providing this information.
496        ///
497        /// Parameter `dict`: A dictionary containing information about
498        /// <i>
499        /// central
500        /// </i>
501        /// that was preserved by the system at the time the app was terminated.
502        ///
503        ///
504        /// For apps that opt-in to state preservation and restoration, this is the first method invoked when your app is relaunched into
505        /// the background to complete some Bluetooth-related task. Use this method to synchronize your app's state with the state of the
506        /// Bluetooth system.
507        ///
508        ///
509        /// See also: CBCentralManagerRestoredStatePeripheralsKey;
510        ///
511        /// See also: CBCentralManagerRestoredStateScanServicesKey;
512        ///
513        /// See also: CBCentralManagerRestoredStateScanOptionsKey;
514        ///
515        /// # Safety
516        ///
517        /// `dict` generic should be of the correct type.
518        #[optional]
519        #[unsafe(method(centralManager:willRestoreState:))]
520        #[unsafe(method_family = none)]
521        unsafe fn centralManager_willRestoreState(
522            &self,
523            central: &CBCentralManager,
524            dict: &NSDictionary<NSString, AnyObject>,
525        );
526
527        #[cfg(all(feature = "CBManager", feature = "CBPeer", feature = "CBPeripheral"))]
528        /// Parameter `central`: The central manager providing this update.
529        ///
530        /// Parameter `peripheral`: A
531        /// <code>
532        /// CBPeripheral
533        /// </code>
534        /// object.
535        ///
536        /// Parameter `advertisementData`: A dictionary containing any advertisement and scan response data.
537        ///
538        /// Parameter `RSSI`: The current RSSI of
539        /// <i>
540        /// peripheral
541        /// </i>
542        /// , in dBm. A value of
543        /// <code>
544        /// 127
545        /// </code>
546        /// is reserved and indicates the RSSI
547        /// was not available.
548        ///
549        ///
550        /// This method is invoked while scanning, upon the discovery of
551        /// <i>
552        /// peripheral
553        /// </i>
554        /// by
555        /// <i>
556        /// central
557        /// </i>
558        /// . A discovered peripheral must
559        /// be retained in order to use it; otherwise, it is assumed to not be of interest and will be cleaned up by the central manager. For
560        /// a list of
561        /// <i>
562        /// advertisementData
563        /// </i>
564        /// keys, see {
565        ///
566        /// ```text
567        ///  CBAdvertisementDataLocalNameKey} and other similar constants.
568        ///
569        ///   @seealso                    CBAdvertisementData.h
570        ///
571        ///  
572        ///
573        /// ```
574        ///
575        /// # Safety
576        ///
577        /// `advertisement_data` generic should be of the correct type.
578        #[optional]
579        #[unsafe(method(centralManager:didDiscoverPeripheral:advertisementData:RSSI:))]
580        #[unsafe(method_family = none)]
581        unsafe fn centralManager_didDiscoverPeripheral_advertisementData_RSSI(
582            &self,
583            central: &CBCentralManager,
584            peripheral: &CBPeripheral,
585            advertisement_data: &NSDictionary<NSString, AnyObject>,
586            rssi: &NSNumber,
587        );
588
589        #[cfg(all(feature = "CBManager", feature = "CBPeer", feature = "CBPeripheral"))]
590        /// Parameter `central`: The central manager providing this information.
591        ///
592        /// Parameter `peripheral`: The
593        /// <code>
594        /// CBPeripheral
595        /// </code>
596        /// that has connected.
597        ///
598        ///
599        /// This method is invoked when a connection initiated by {
600        ///
601        /// ```text
602        ///  connectPeripheral:options:} has succeeded.
603        ///
604        ///  
605        ///
606        /// ```
607        #[optional]
608        #[unsafe(method(centralManager:didConnectPeripheral:))]
609        #[unsafe(method_family = none)]
610        unsafe fn centralManager_didConnectPeripheral(
611            &self,
612            central: &CBCentralManager,
613            peripheral: &CBPeripheral,
614        );
615
616        #[cfg(all(feature = "CBManager", feature = "CBPeer", feature = "CBPeripheral"))]
617        /// Parameter `central`: The central manager providing this information.
618        ///
619        /// Parameter `peripheral`: The
620        /// <code>
621        /// CBPeripheral
622        /// </code>
623        /// that has failed to connect.
624        ///
625        /// Parameter `error`: The cause of the failure.
626        ///
627        ///
628        /// This method is invoked when a connection initiated by {
629        ///
630        /// ```text
631        ///  connectPeripheral:options:} has failed to complete. As connection attempts do not
632        ///                       timeout, the failure of a connection is atypical and usually indicative of a transient issue.
633        ///
634        ///  
635        ///
636        /// ```
637        #[optional]
638        #[unsafe(method(centralManager:didFailToConnectPeripheral:error:))]
639        #[unsafe(method_family = none)]
640        unsafe fn centralManager_didFailToConnectPeripheral_error(
641            &self,
642            central: &CBCentralManager,
643            peripheral: &CBPeripheral,
644            error: Option<&NSError>,
645        );
646
647        #[cfg(all(feature = "CBManager", feature = "CBPeer", feature = "CBPeripheral"))]
648        /// Parameter `central`: The central manager providing this information.
649        ///
650        /// Parameter `peripheral`: The
651        /// <code>
652        /// CBPeripheral
653        /// </code>
654        /// that has disconnected.
655        ///
656        /// Parameter `error`: If an error occurred, the cause of the failure.
657        ///
658        ///
659        /// This method is invoked upon the disconnection of a peripheral that was connected by {
660        ///
661        /// ```text
662        ///  connectPeripheral:options:}. If the disconnection
663        ///                       was not initiated by {@link cancelPeripheralConnection}, the cause will be detailed in the <i>error</i> parameter. Once this method has been
664        ///                       called, no more methods will be invoked on <i>peripheral</i>'s <code>CBPeripheralDelegate</code>.
665        ///
666        ///  
667        ///
668        /// ```
669        #[optional]
670        #[unsafe(method(centralManager:didDisconnectPeripheral:error:))]
671        #[unsafe(method_family = none)]
672        unsafe fn centralManager_didDisconnectPeripheral_error(
673            &self,
674            central: &CBCentralManager,
675            peripheral: &CBPeripheral,
676            error: Option<&NSError>,
677        );
678
679        #[cfg(all(
680            feature = "CBManager",
681            feature = "CBPeer",
682            feature = "CBPeripheral",
683            feature = "objc2-core-foundation"
684        ))]
685        /// Parameter `central`: The central manager providing this information.
686        ///
687        /// Parameter `peripheral`: The
688        /// <code>
689        /// CBPeripheral
690        /// </code>
691        /// that has disconnected.
692        ///
693        /// Parameter `timestamp`: Timestamp of the disconnection, it can be now or a few seconds ago.
694        ///
695        /// Parameter `isReconnecting`: If reconnect was triggered upon disconnection.
696        ///
697        /// Parameter `error`: If an error occurred, the cause of the failure.
698        ///
699        ///
700        /// This method is invoked upon the disconnection of a peripheral that was connected by {
701        ///
702        /// ```text
703        ///  connectPeripheral:options:}. If perihperal is
704        ///                       connected with connect option {@link CBConnectPeripheralOptionEnableAutoReconnect}, once this method has been called, the system
705        ///                       will automatically invoke connect to the peripheral. And if connection is established with the peripheral afterwards,
706        ///                       {@link centralManager:didConnectPeripheral:} can be invoked. If perihperal is connected without option
707        ///                       CBConnectPeripheralOptionEnableAutoReconnect, once this method has been called, no more methods will be invoked on
708        ///                        <i>peripheral</i>'s <code>CBPeripheralDelegate</code> .
709        ///
710        ///  
711        ///
712        /// ```
713        #[optional]
714        #[unsafe(method(centralManager:didDisconnectPeripheral:timestamp:isReconnecting:error:))]
715        #[unsafe(method_family = none)]
716        unsafe fn centralManager_didDisconnectPeripheral_timestamp_isReconnecting_error(
717            &self,
718            central: &CBCentralManager,
719            peripheral: &CBPeripheral,
720            timestamp: CFAbsoluteTime,
721            is_reconnecting: bool,
722            error: Option<&NSError>,
723        );
724
725        #[cfg(all(feature = "CBManager", feature = "CBPeer", feature = "CBPeripheral"))]
726        /// Parameter `central`: The central manager providing this information.
727        ///
728        /// Parameter `event`: The
729        /// <code>
730        /// CBConnectionEvent
731        /// </code>
732        /// that has occurred.
733        ///
734        /// Parameter `peripheral`: The
735        /// <code>
736        /// CBPeripheral
737        /// </code>
738        /// that caused the event.
739        ///
740        ///
741        /// This method is invoked upon the connection or disconnection of a peripheral that matches any of the options provided in {
742        ///
743        /// ```text
744        ///  registerForConnectionEventsWithOptions:}.
745        ///
746        ///  
747        ///
748        /// ```
749        #[optional]
750        #[unsafe(method(centralManager:connectionEventDidOccur:forPeripheral:))]
751        #[unsafe(method_family = none)]
752        unsafe fn centralManager_connectionEventDidOccur_forPeripheral(
753            &self,
754            central: &CBCentralManager,
755            event: CBConnectionEvent,
756            peripheral: &CBPeripheral,
757        );
758
759        #[cfg(all(feature = "CBManager", feature = "CBPeer", feature = "CBPeripheral"))]
760        /// Parameter `central`: The central manager providing this information.
761        ///
762        /// Parameter `peripheral`: The
763        /// <code>
764        /// CBPeripheral
765        /// </code>
766        /// that caused the event.
767        ///
768        ///
769        /// This method is invoked when the authorization status changes for a peripheral connected with {
770        ///
771        /// ```text
772        ///  connectPeripheral:} option {@link CBConnectPeripheralOptionRequiresANCS}.
773        ///
774        ///  
775        ///
776        /// ```
777        #[optional]
778        #[unsafe(method(centralManager:didUpdateANCSAuthorizationForPeripheral:))]
779        #[unsafe(method_family = none)]
780        unsafe fn centralManager_didUpdateANCSAuthorizationForPeripheral(
781            &self,
782            central: &CBCentralManager,
783            peripheral: &CBPeripheral,
784        );
785    }
786);