objc2-core-bluetooth 0.3.2

Bindings to the CoreBluetooth framework
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
#[cfg(feature = "dispatch2")]
use dispatch2::*;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
use objc2_foundation::*;

use crate::*;

/// Represents the current state of a CBCentralManager.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/corebluetooth/cbcentralmanagerstate?language=objc)
// NS_ENUM
#[deprecated = "Use CBManagerState instead"]
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CBCentralManagerState(pub NSInteger);
impl CBCentralManagerState {
    #[doc(alias = "CBCentralManagerStateUnknown")]
    #[cfg(feature = "CBManager")]
    #[deprecated = "Use CBManagerState instead"]
    pub const Unknown: Self = Self(CBManagerState::Unknown.0);
    #[doc(alias = "CBCentralManagerStateResetting")]
    #[cfg(feature = "CBManager")]
    #[deprecated = "Use CBManagerState instead"]
    pub const Resetting: Self = Self(CBManagerState::Resetting.0);
    #[doc(alias = "CBCentralManagerStateUnsupported")]
    #[cfg(feature = "CBManager")]
    #[deprecated = "Use CBManagerState instead"]
    pub const Unsupported: Self = Self(CBManagerState::Unsupported.0);
    #[doc(alias = "CBCentralManagerStateUnauthorized")]
    #[cfg(feature = "CBManager")]
    #[deprecated = "Use CBManagerState instead"]
    pub const Unauthorized: Self = Self(CBManagerState::Unauthorized.0);
    #[doc(alias = "CBCentralManagerStatePoweredOff")]
    #[cfg(feature = "CBManager")]
    #[deprecated = "Use CBManagerState instead"]
    pub const PoweredOff: Self = Self(CBManagerState::PoweredOff.0);
    #[doc(alias = "CBCentralManagerStatePoweredOn")]
    #[cfg(feature = "CBManager")]
    #[deprecated = "Use CBManagerState instead"]
    pub const PoweredOn: Self = Self(CBManagerState::PoweredOn.0);
}

unsafe impl Encode for CBCentralManagerState {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for CBCentralManagerState {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// Represents the connection state of a peer.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/corebluetooth/cbconnectionevent?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CBConnectionEvent(pub NSInteger);
impl CBConnectionEvent {
    #[doc(alias = "CBConnectionEventPeerDisconnected")]
    pub const PeerDisconnected: Self = Self(0);
    #[doc(alias = "CBConnectionEventPeerConnected")]
    pub const PeerConnected: Self = Self(1);
}

unsafe impl Encode for CBConnectionEvent {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for CBConnectionEvent {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// The set of device specific features.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/corebluetooth/cbcentralmanagerfeature?language=objc)
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CBCentralManagerFeature(pub NSUInteger);
bitflags::bitflags! {
    impl CBCentralManagerFeature: NSUInteger {
        #[doc(alias = "CBCentralManagerFeatureExtendedScanAndConnect")]
        const ExtendedScanAndConnect = 1<<0;
    }
}

unsafe impl Encode for CBCentralManagerFeature {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for CBCentralManagerFeature {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    /// Entry point to the central role. Commands should only be issued when its state is
    /// <code>
    /// CBCentralManagerStatePoweredOn
    /// </code>
    /// .
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/corebluetooth/cbcentralmanager?language=objc)
    #[unsafe(super(CBManager, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "CBManager")]
    pub struct CBCentralManager;
);

#[cfg(feature = "CBManager")]
extern_conformance!(
    unsafe impl NSObjectProtocol for CBCentralManager {}
);

#[cfg(feature = "CBManager")]
impl CBCentralManager {
    extern_methods!(
        /// The delegate object that will receive central events.
        #[unsafe(method(delegate))]
        #[unsafe(method_family = none)]
        pub unsafe fn delegate(
            &self,
        ) -> Option<Retained<ProtocolObject<dyn CBCentralManagerDelegate>>>;

        /// Setter for [`delegate`][Self::delegate].
        ///
        /// This is a [weak property][objc2::topics::weak_property].
        #[unsafe(method(setDelegate:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setDelegate(
            &self,
            delegate: Option<&ProtocolObject<dyn CBCentralManagerDelegate>>,
        );

        /// Whether or not the central is currently scanning.
        #[unsafe(method(isScanning))]
        #[unsafe(method_family = none)]
        pub unsafe fn isScanning(&self) -> bool;

        /// Parameter `features`: One or more features you would like to check if supported.
        ///
        ///
        /// Returns a boolean value representing the support for the provided features.
        #[unsafe(method(supportsFeatures:))]
        #[unsafe(method_family = none)]
        pub unsafe fn supportsFeatures(features: CBCentralManagerFeature) -> bool;

        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[cfg(feature = "dispatch2")]
        /// Parameter `delegate`: The delegate that will receive central role events.
        ///
        /// Parameter `queue`: The dispatch queue on which the events will be dispatched.
        ///
        ///
        /// The initialization call. The events of the central role will be dispatched on the provided queue.
        /// If
        /// <i>
        /// nil
        /// </i>
        /// , the main queue will be used.
        ///
        /// # Safety
        ///
        /// `queue` possibly has additional threading requirements.
        #[unsafe(method(initWithDelegate:queue:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithDelegate_queue(
            this: Allocated<Self>,
            delegate: Option<&ProtocolObject<dyn CBCentralManagerDelegate>>,
            queue: Option<&DispatchQueue>,
        ) -> Retained<Self>;

        #[cfg(feature = "dispatch2")]
        /// Parameter `delegate`: The delegate that will receive central role events.
        ///
        /// Parameter `queue`: The dispatch queue on which the events will be dispatched.
        ///
        /// Parameter `options`: An optional dictionary specifying options for the manager.
        ///
        ///
        /// The initialization call. The events of the central role will be dispatched on the provided queue.
        /// If
        /// <i>
        /// nil
        /// </i>
        /// , the main queue will be used.
        ///
        ///
        /// See also: CBCentralManagerOptionShowPowerAlertKey
        ///
        /// See also: CBCentralManagerOptionRestoreIdentifierKey
        ///
        /// # Safety
        ///
        /// - `queue` possibly has additional threading requirements.
        /// - `options` generic should be of the correct type.
        #[unsafe(method(initWithDelegate:queue:options:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithDelegate_queue_options(
            this: Allocated<Self>,
            delegate: Option<&ProtocolObject<dyn CBCentralManagerDelegate>>,
            queue: Option<&DispatchQueue>,
            options: Option<&NSDictionary<NSString, AnyObject>>,
        ) -> Retained<Self>;

        #[cfg(all(feature = "CBPeer", feature = "CBPeripheral"))]
        /// Parameter `identifiers`: A list of
        /// <code>
        /// NSUUID
        /// </code>
        /// objects.
        ///
        ///
        /// Attempts to retrieve the
        /// <code>
        /// CBPeripheral
        /// </code>
        /// object(s) with the corresponding
        /// <i>
        /// identifiers
        /// </i>
        /// .
        ///
        ///
        /// Returns: A list of
        /// <code>
        /// CBPeripheral
        /// </code>
        /// objects.
        #[unsafe(method(retrievePeripheralsWithIdentifiers:))]
        #[unsafe(method_family = none)]
        pub unsafe fn retrievePeripheralsWithIdentifiers(
            &self,
            identifiers: &NSArray<NSUUID>,
        ) -> Retained<NSArray<CBPeripheral>>;

        #[cfg(all(feature = "CBPeer", feature = "CBPeripheral", feature = "CBUUID"))]
        /// Retrieves all peripherals that are connected to the system and implement any of the services listed in
        /// <i>
        /// serviceUUIDs
        /// </i>
        /// .
        /// Note that this set can include peripherals which were connected by other applications, which will need to be connected locally
        /// via {
        ///
        /// ```text
        ///  connectPeripheral:options:} before they can be used.
        ///
        ///     @return        A list of <code>CBPeripheral</code> objects.
        ///
        ///  
        ///
        /// ```
        #[unsafe(method(retrieveConnectedPeripheralsWithServices:))]
        #[unsafe(method_family = none)]
        pub unsafe fn retrieveConnectedPeripheralsWithServices(
            &self,
            service_uui_ds: &NSArray<CBUUID>,
        ) -> Retained<NSArray<CBPeripheral>>;

        #[cfg(feature = "CBUUID")]
        /// Parameter `serviceUUIDs`: A list of
        /// <code>
        /// CBUUID
        /// </code>
        /// objects representing the service(s) to scan for.
        ///
        /// Parameter `options`: An optional dictionary specifying options for the scan.
        ///
        ///
        /// Starts scanning for peripherals that are advertising any of the services listed in
        /// <i>
        /// serviceUUIDs
        /// </i>
        /// . Although strongly discouraged,
        /// if
        /// <i>
        /// serviceUUIDs
        /// </i>
        /// is
        /// <i>
        /// nil
        /// </i>
        /// all discovered peripherals will be returned. If the central is already scanning with different
        /// <i>
        /// serviceUUIDs
        /// </i>
        /// or
        /// <i>
        /// options
        /// </i>
        /// , the provided parameters will replace them.
        /// Applications that have specified the
        /// <code>
        /// bluetooth-central
        /// </code>
        /// background mode are allowed to scan while backgrounded, with two
        /// caveats: the scan must specify one or more service types in
        /// <i>
        /// serviceUUIDs
        /// </i>
        /// , and the
        /// <code>
        /// CBCentralManagerScanOptionAllowDuplicatesKey
        /// </code>
        /// scan option will be ignored.
        ///
        ///
        /// See: centralManager:didDiscoverPeripheral:advertisementData:RSSI:
        ///
        /// See also: CBCentralManagerScanOptionAllowDuplicatesKey
        ///
        /// See also: CBCentralManagerScanOptionSolicitedServiceUUIDsKey
        ///
        /// # Safety
        ///
        /// `options` generic should be of the correct type.
        #[unsafe(method(scanForPeripheralsWithServices:options:))]
        #[unsafe(method_family = none)]
        pub unsafe fn scanForPeripheralsWithServices_options(
            &self,
            service_uui_ds: Option<&NSArray<CBUUID>>,
            options: Option<&NSDictionary<NSString, AnyObject>>,
        );

        /// Stops scanning for peripherals.
        #[unsafe(method(stopScan))]
        #[unsafe(method_family = none)]
        pub unsafe fn stopScan(&self);

        #[cfg(all(feature = "CBPeer", feature = "CBPeripheral"))]
        /// Parameter `peripheral`: The
        /// <code>
        /// CBPeripheral
        /// </code>
        /// to be connected.
        ///
        /// Parameter `options`: An optional dictionary specifying connection behavior options.
        ///
        ///
        /// Initiates a connection to
        /// <i>
        /// peripheral
        /// </i>
        /// . Connection attempts never time out and, depending on the outcome, will result
        /// in a call to either {
        ///
        /// ```text
        ///  centralManager:didConnectPeripheral:} or {@link centralManager:didFailToConnectPeripheral:error:}.
        ///                       Pending attempts are cancelled automatically upon deallocation of <i>peripheral</i>, and explicitly via {@link cancelPeripheralConnection}.
        ///
        ///   @see                centralManager:didConnectPeripheral:
        ///   @see                centralManager:didFailToConnectPeripheral:error:
        ///   @seealso            CBConnectPeripheralOptionNotifyOnConnectionKey
        ///   @seealso            CBConnectPeripheralOptionNotifyOnDisconnectionKey
        ///   @seealso            CBConnectPeripheralOptionNotifyOnNotificationKey
        ///   @seealso            CBConnectPeripheralOptionEnableTransportBridgingKey
        ///     @seealso            CBConnectPeripheralOptionRequiresANCS
        ///   @seealso            CBConnectPeripheralOptionEnableAutoReconnect
        ///
        ///  
        ///
        /// ```
        ///
        /// # Safety
        ///
        /// `options` generic should be of the correct type.
        #[unsafe(method(connectPeripheral:options:))]
        #[unsafe(method_family = none)]
        pub unsafe fn connectPeripheral_options(
            &self,
            peripheral: &CBPeripheral,
            options: Option<&NSDictionary<NSString, AnyObject>>,
        );

        #[cfg(all(feature = "CBPeer", feature = "CBPeripheral"))]
        /// Parameter `peripheral`: A
        /// <code>
        /// CBPeripheral
        /// </code>
        /// .
        ///
        ///
        /// Cancels an active or pending connection to
        /// <i>
        /// peripheral
        /// </i>
        /// . Note that this is non-blocking, and any
        /// <code>
        /// CBPeripheral
        /// </code>
        /// commands that are still pending to
        /// <i>
        /// peripheral
        /// </i>
        /// may or may not complete.
        ///
        ///
        /// See: centralManager:didDisconnectPeripheral:error:
        #[unsafe(method(cancelPeripheralConnection:))]
        #[unsafe(method_family = none)]
        pub unsafe fn cancelPeripheralConnection(&self, peripheral: &CBPeripheral);

        #[cfg(feature = "CBCentralManagerConstants")]
        /// Parameter `options`: A dictionary specifying connection event options.
        ///
        ///
        /// Calls {
        ///
        /// ```text
        ///  centralManager:connectionEventDidOccur:forPeripheral:} when a connection event occurs matching any of the given options.
        ///                       Passing nil in the option parameter clears any prior registered matching options.
        ///
        ///   @see                centralManager:connectionEventDidOccur:forPeripheral:
        ///   @seealso            CBConnectionEventMatchingOptionServiceUUIDs
        ///   @seealso            CBConnectionEventMatchingOptionPeripheralUUIDs
        ///  
        ///
        /// ```
        ///
        /// # Safety
        ///
        /// `options` generic should be of the correct type.
        #[unsafe(method(registerForConnectionEventsWithOptions:))]
        #[unsafe(method_family = none)]
        pub unsafe fn registerForConnectionEventsWithOptions(
            &self,
            options: Option<&NSDictionary<CBConnectionEventMatchingOption, AnyObject>>,
        );
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(feature = "CBManager")]
impl CBCentralManager {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

extern_protocol!(
    /// The delegate of a {
    ///
    /// ```text
    ///  CBCentralManager} object must adopt the <code>CBCentralManagerDelegate</code> protocol. The
    ///               single required method indicates the availability of the central manager, while the optional methods allow for the discovery and
    ///               connection of peripherals.
    ///
    ///  
    ///
    /// ```
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/corebluetooth/cbcentralmanagerdelegate?language=objc)
    pub unsafe trait CBCentralManagerDelegate: NSObjectProtocol {
        #[cfg(feature = "CBManager")]
        /// Parameter `central`: The central manager whose state has changed.
        ///
        ///
        /// Invoked whenever the central manager's state has been updated. Commands should only be issued when the state is
        /// <code>
        /// CBCentralManagerStatePoweredOn
        /// </code>
        /// . A state below
        /// <code>
        /// CBCentralManagerStatePoweredOn
        /// </code>
        /// implies that scanning has stopped and any connected peripherals have been disconnected. If the state moves below
        /// <code>
        /// CBCentralManagerStatePoweredOff
        /// </code>
        /// , all
        /// <code>
        /// CBPeripheral
        /// </code>
        /// objects obtained from this central
        /// manager become invalid and must be retrieved or discovered again.
        ///
        ///
        /// See: state
        #[unsafe(method(centralManagerDidUpdateState:))]
        #[unsafe(method_family = none)]
        unsafe fn centralManagerDidUpdateState(&self, central: &CBCentralManager);

        #[cfg(feature = "CBManager")]
        /// Parameter `central`: The central manager providing this information.
        ///
        /// Parameter `dict`: A dictionary containing information about
        /// <i>
        /// central
        /// </i>
        /// that was preserved by the system at the time the app was terminated.
        ///
        ///
        /// For apps that opt-in to state preservation and restoration, this is the first method invoked when your app is relaunched into
        /// the background to complete some Bluetooth-related task. Use this method to synchronize your app's state with the state of the
        /// Bluetooth system.
        ///
        ///
        /// See also: CBCentralManagerRestoredStatePeripheralsKey;
        ///
        /// See also: CBCentralManagerRestoredStateScanServicesKey;
        ///
        /// See also: CBCentralManagerRestoredStateScanOptionsKey;
        ///
        /// # Safety
        ///
        /// `dict` generic should be of the correct type.
        #[optional]
        #[unsafe(method(centralManager:willRestoreState:))]
        #[unsafe(method_family = none)]
        unsafe fn centralManager_willRestoreState(
            &self,
            central: &CBCentralManager,
            dict: &NSDictionary<NSString, AnyObject>,
        );

        #[cfg(all(feature = "CBManager", feature = "CBPeer", feature = "CBPeripheral"))]
        /// Parameter `central`: The central manager providing this update.
        ///
        /// Parameter `peripheral`: A
        /// <code>
        /// CBPeripheral
        /// </code>
        /// object.
        ///
        /// Parameter `advertisementData`: A dictionary containing any advertisement and scan response data.
        ///
        /// Parameter `RSSI`: The current RSSI of
        /// <i>
        /// peripheral
        /// </i>
        /// , in dBm. A value of
        /// <code>
        /// 127
        /// </code>
        /// is reserved and indicates the RSSI
        /// was not available.
        ///
        ///
        /// This method is invoked while scanning, upon the discovery of
        /// <i>
        /// peripheral
        /// </i>
        /// by
        /// <i>
        /// central
        /// </i>
        /// . A discovered peripheral must
        /// 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
        /// a list of
        /// <i>
        /// advertisementData
        /// </i>
        /// keys, see {
        ///
        /// ```text
        ///  CBAdvertisementDataLocalNameKey} and other similar constants.
        ///
        ///   @seealso                    CBAdvertisementData.h
        ///
        ///  
        ///
        /// ```
        ///
        /// # Safety
        ///
        /// `advertisement_data` generic should be of the correct type.
        #[optional]
        #[unsafe(method(centralManager:didDiscoverPeripheral:advertisementData:RSSI:))]
        #[unsafe(method_family = none)]
        unsafe fn centralManager_didDiscoverPeripheral_advertisementData_RSSI(
            &self,
            central: &CBCentralManager,
            peripheral: &CBPeripheral,
            advertisement_data: &NSDictionary<NSString, AnyObject>,
            rssi: &NSNumber,
        );

        #[cfg(all(feature = "CBManager", feature = "CBPeer", feature = "CBPeripheral"))]
        /// Parameter `central`: The central manager providing this information.
        ///
        /// Parameter `peripheral`: The
        /// <code>
        /// CBPeripheral
        /// </code>
        /// that has connected.
        ///
        ///
        /// This method is invoked when a connection initiated by {
        ///
        /// ```text
        ///  connectPeripheral:options:} has succeeded.
        ///
        ///  
        ///
        /// ```
        #[optional]
        #[unsafe(method(centralManager:didConnectPeripheral:))]
        #[unsafe(method_family = none)]
        unsafe fn centralManager_didConnectPeripheral(
            &self,
            central: &CBCentralManager,
            peripheral: &CBPeripheral,
        );

        #[cfg(all(feature = "CBManager", feature = "CBPeer", feature = "CBPeripheral"))]
        /// Parameter `central`: The central manager providing this information.
        ///
        /// Parameter `peripheral`: The
        /// <code>
        /// CBPeripheral
        /// </code>
        /// that has failed to connect.
        ///
        /// Parameter `error`: The cause of the failure.
        ///
        ///
        /// This method is invoked when a connection initiated by {
        ///
        /// ```text
        ///  connectPeripheral:options:} has failed to complete. As connection attempts do not
        ///                       timeout, the failure of a connection is atypical and usually indicative of a transient issue.
        ///
        ///  
        ///
        /// ```
        #[optional]
        #[unsafe(method(centralManager:didFailToConnectPeripheral:error:))]
        #[unsafe(method_family = none)]
        unsafe fn centralManager_didFailToConnectPeripheral_error(
            &self,
            central: &CBCentralManager,
            peripheral: &CBPeripheral,
            error: Option<&NSError>,
        );

        #[cfg(all(feature = "CBManager", feature = "CBPeer", feature = "CBPeripheral"))]
        /// Parameter `central`: The central manager providing this information.
        ///
        /// Parameter `peripheral`: The
        /// <code>
        /// CBPeripheral
        /// </code>
        /// that has disconnected.
        ///
        /// Parameter `error`: If an error occurred, the cause of the failure.
        ///
        ///
        /// This method is invoked upon the disconnection of a peripheral that was connected by {
        ///
        /// ```text
        ///  connectPeripheral:options:}. If the disconnection
        ///                       was not initiated by {@link cancelPeripheralConnection}, the cause will be detailed in the <i>error</i> parameter. Once this method has been
        ///                       called, no more methods will be invoked on <i>peripheral</i>'s <code>CBPeripheralDelegate</code>.
        ///
        ///  
        ///
        /// ```
        #[optional]
        #[unsafe(method(centralManager:didDisconnectPeripheral:error:))]
        #[unsafe(method_family = none)]
        unsafe fn centralManager_didDisconnectPeripheral_error(
            &self,
            central: &CBCentralManager,
            peripheral: &CBPeripheral,
            error: Option<&NSError>,
        );

        #[cfg(all(
            feature = "CBManager",
            feature = "CBPeer",
            feature = "CBPeripheral",
            feature = "objc2-core-foundation"
        ))]
        /// Parameter `central`: The central manager providing this information.
        ///
        /// Parameter `peripheral`: The
        /// <code>
        /// CBPeripheral
        /// </code>
        /// that has disconnected.
        ///
        /// Parameter `timestamp`: Timestamp of the disconnection, it can be now or a few seconds ago.
        ///
        /// Parameter `isReconnecting`: If reconnect was triggered upon disconnection.
        ///
        /// Parameter `error`: If an error occurred, the cause of the failure.
        ///
        ///
        /// This method is invoked upon the disconnection of a peripheral that was connected by {
        ///
        /// ```text
        ///  connectPeripheral:options:}. If perihperal is
        ///                       connected with connect option {@link CBConnectPeripheralOptionEnableAutoReconnect}, once this method has been called, the system
        ///                       will automatically invoke connect to the peripheral. And if connection is established with the peripheral afterwards,
        ///                       {@link centralManager:didConnectPeripheral:} can be invoked. If perihperal is connected without option
        ///                       CBConnectPeripheralOptionEnableAutoReconnect, once this method has been called, no more methods will be invoked on
        ///                        <i>peripheral</i>'s <code>CBPeripheralDelegate</code> .
        ///
        ///  
        ///
        /// ```
        #[optional]
        #[unsafe(method(centralManager:didDisconnectPeripheral:timestamp:isReconnecting:error:))]
        #[unsafe(method_family = none)]
        unsafe fn centralManager_didDisconnectPeripheral_timestamp_isReconnecting_error(
            &self,
            central: &CBCentralManager,
            peripheral: &CBPeripheral,
            timestamp: CFAbsoluteTime,
            is_reconnecting: bool,
            error: Option<&NSError>,
        );

        #[cfg(all(feature = "CBManager", feature = "CBPeer", feature = "CBPeripheral"))]
        /// Parameter `central`: The central manager providing this information.
        ///
        /// Parameter `event`: The
        /// <code>
        /// CBConnectionEvent
        /// </code>
        /// that has occurred.
        ///
        /// Parameter `peripheral`: The
        /// <code>
        /// CBPeripheral
        /// </code>
        /// that caused the event.
        ///
        ///
        /// This method is invoked upon the connection or disconnection of a peripheral that matches any of the options provided in {
        ///
        /// ```text
        ///  registerForConnectionEventsWithOptions:}.
        ///
        ///  
        ///
        /// ```
        #[optional]
        #[unsafe(method(centralManager:connectionEventDidOccur:forPeripheral:))]
        #[unsafe(method_family = none)]
        unsafe fn centralManager_connectionEventDidOccur_forPeripheral(
            &self,
            central: &CBCentralManager,
            event: CBConnectionEvent,
            peripheral: &CBPeripheral,
        );

        #[cfg(all(feature = "CBManager", feature = "CBPeer", feature = "CBPeripheral"))]
        /// Parameter `central`: The central manager providing this information.
        ///
        /// Parameter `peripheral`: The
        /// <code>
        /// CBPeripheral
        /// </code>
        /// that caused the event.
        ///
        ///
        /// This method is invoked when the authorization status changes for a peripheral connected with {
        ///
        /// ```text
        ///  connectPeripheral:} option {@link CBConnectPeripheralOptionRequiresANCS}.
        ///
        ///  
        ///
        /// ```
        #[optional]
        #[unsafe(method(centralManager:didUpdateANCSAuthorizationForPeripheral:))]
        #[unsafe(method_family = none)]
        unsafe fn centralManager_didUpdateANCSAuthorizationForPeripheral(
            &self,
            central: &CBCentralManager,
            peripheral: &CBPeripheral,
        );
    }
);