objc2_core_bluetooth/generated/
CBPeripheralManager.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::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12/// Represents the current state of a CBPeripheralManager.
13///
14/// See also [Apple's documentation](https://developer.apple.com/documentation/corebluetooth/cbperipheralmanagerauthorizationstatus?language=objc)
15// NS_ENUM
16#[deprecated = "Use CBManagerAuthorization instead"]
17#[repr(transparent)]
18#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
19pub struct CBPeripheralManagerAuthorizationStatus(pub NSInteger);
20impl CBPeripheralManagerAuthorizationStatus {
21    #[doc(alias = "CBPeripheralManagerAuthorizationStatusNotDetermined")]
22    #[deprecated = "Use CBManagerAuthorization instead"]
23    pub const NotDetermined: Self = Self(0);
24    #[doc(alias = "CBPeripheralManagerAuthorizationStatusRestricted")]
25    #[deprecated = "Use CBManagerAuthorization instead"]
26    pub const Restricted: Self = Self(1);
27    #[doc(alias = "CBPeripheralManagerAuthorizationStatusDenied")]
28    #[deprecated = "Use CBManagerAuthorization instead"]
29    pub const Denied: Self = Self(2);
30    #[doc(alias = "CBPeripheralManagerAuthorizationStatusAuthorized")]
31    #[deprecated = "Use CBManagerAuthorization instead"]
32    pub const Authorized: Self = Self(3);
33}
34
35unsafe impl Encode for CBPeripheralManagerAuthorizationStatus {
36    const ENCODING: Encoding = NSInteger::ENCODING;
37}
38
39unsafe impl RefEncode for CBPeripheralManagerAuthorizationStatus {
40    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
41}
42
43/// Represents the current state of a CBPeripheralManager.
44///
45/// See also [Apple's documentation](https://developer.apple.com/documentation/corebluetooth/cbperipheralmanagerstate?language=objc)
46// NS_ENUM
47#[deprecated = "Use CBManagerState instead"]
48#[repr(transparent)]
49#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
50pub struct CBPeripheralManagerState(pub NSInteger);
51impl CBPeripheralManagerState {
52    #[doc(alias = "CBPeripheralManagerStateUnknown")]
53    #[cfg(feature = "CBManager")]
54    #[deprecated = "Use CBManagerState instead"]
55    pub const Unknown: Self = Self(CBManagerState::Unknown.0);
56    #[doc(alias = "CBPeripheralManagerStateResetting")]
57    #[cfg(feature = "CBManager")]
58    #[deprecated = "Use CBManagerState instead"]
59    pub const Resetting: Self = Self(CBManagerState::Resetting.0);
60    #[doc(alias = "CBPeripheralManagerStateUnsupported")]
61    #[cfg(feature = "CBManager")]
62    #[deprecated = "Use CBManagerState instead"]
63    pub const Unsupported: Self = Self(CBManagerState::Unsupported.0);
64    #[doc(alias = "CBPeripheralManagerStateUnauthorized")]
65    #[cfg(feature = "CBManager")]
66    #[deprecated = "Use CBManagerState instead"]
67    pub const Unauthorized: Self = Self(CBManagerState::Unauthorized.0);
68    #[doc(alias = "CBPeripheralManagerStatePoweredOff")]
69    #[cfg(feature = "CBManager")]
70    #[deprecated = "Use CBManagerState instead"]
71    pub const PoweredOff: Self = Self(CBManagerState::PoweredOff.0);
72    #[doc(alias = "CBPeripheralManagerStatePoweredOn")]
73    #[cfg(feature = "CBManager")]
74    #[deprecated = "Use CBManagerState instead"]
75    pub const PoweredOn: Self = Self(CBManagerState::PoweredOn.0);
76}
77
78unsafe impl Encode for CBPeripheralManagerState {
79    const ENCODING: Encoding = NSInteger::ENCODING;
80}
81
82unsafe impl RefEncode for CBPeripheralManagerState {
83    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
84}
85
86/// The latency of a peripheral-central connection controls how frequently messages can be exchanged.
87///
88/// See also [Apple's documentation](https://developer.apple.com/documentation/corebluetooth/cbperipheralmanagerconnectionlatency?language=objc)
89// NS_ENUM
90#[repr(transparent)]
91#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
92pub struct CBPeripheralManagerConnectionLatency(pub NSInteger);
93impl CBPeripheralManagerConnectionLatency {
94    #[doc(alias = "CBPeripheralManagerConnectionLatencyLow")]
95    pub const Low: Self = Self(0);
96    #[doc(alias = "CBPeripheralManagerConnectionLatencyMedium")]
97    pub const Medium: Self = Self(1);
98    #[doc(alias = "CBPeripheralManagerConnectionLatencyHigh")]
99    pub const High: Self = Self(2);
100}
101
102unsafe impl Encode for CBPeripheralManagerConnectionLatency {
103    const ENCODING: Encoding = NSInteger::ENCODING;
104}
105
106unsafe impl RefEncode for CBPeripheralManagerConnectionLatency {
107    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
108}
109
110extern_class!(
111    /// The
112    /// <code>
113    /// CBPeripheralManager
114    /// </code>
115    /// class is an abstraction of the Peripheral and Broadcaster GAP roles, and the GATT Server
116    /// role. Its primary function is to allow you to manage published services within the GATT database, and to advertise these services
117    /// to other devices.
118    /// Each application has sandboxed access to the shared GATT database. You can add services to the database by calling {
119    ///
120    /// ```text
121    ///  addService:};
122    ///               they can be removed via {@link removeService:} and {@link removeAllServices}, as appropriate. While a service is in the database,
123    ///               it is visible to and can be accessed by any connected GATT Client. However, applications that have not specified the "bluetooth-peripheral"
124    ///               background mode will have the contents of their service(s) "disabled" when in the background. Any remote device trying to access
125    ///               characteristic values or descriptors during this time will receive an error response.
126    ///               Once you've published services that you want to share, you can ask to advertise their availability and allow other devices to connect
127    ///               to you by calling {@link startAdvertising:}. Like the GATT database, advertisement is managed at the system level and shared by all
128    ///               applications. This means that even if you aren't advertising at the moment, someone else might be!
129    ///
130    ///  
131    ///
132    /// ```
133    ///
134    /// See also [Apple's documentation](https://developer.apple.com/documentation/corebluetooth/cbperipheralmanager?language=objc)
135    #[unsafe(super(CBManager, NSObject))]
136    #[derive(Debug, PartialEq, Eq, Hash)]
137    #[cfg(feature = "CBManager")]
138    pub struct CBPeripheralManager;
139);
140
141#[cfg(feature = "CBManager")]
142extern_conformance!(
143    unsafe impl NSObjectProtocol for CBPeripheralManager {}
144);
145
146#[cfg(feature = "CBManager")]
147impl CBPeripheralManager {
148    extern_methods!(
149        /// The delegate object that will receive peripheral events.
150        #[unsafe(method(delegate))]
151        #[unsafe(method_family = none)]
152        pub unsafe fn delegate(
153            &self,
154        ) -> Option<Retained<ProtocolObject<dyn CBPeripheralManagerDelegate>>>;
155
156        /// Setter for [`delegate`][Self::delegate].
157        ///
158        /// This is a [weak property][objc2::topics::weak_property].
159        #[unsafe(method(setDelegate:))]
160        #[unsafe(method_family = none)]
161        pub unsafe fn setDelegate(
162            &self,
163            delegate: Option<&ProtocolObject<dyn CBPeripheralManagerDelegate>>,
164        );
165
166        /// Whether or not the peripheral is currently advertising data.
167        #[unsafe(method(isAdvertising))]
168        #[unsafe(method_family = none)]
169        pub unsafe fn isAdvertising(&self) -> bool;
170
171        /// This method does not prompt the user for access. You can use it to detect restricted access and simply hide UI instead of
172        /// prompting for access.
173        ///
174        ///
175        /// Returns: The current authorization status for sharing data while backgrounded. For the constants returned, see {
176        ///
177        /// ```text
178        ///  CBPeripheralManagerAuthorizationStatus}.
179        ///
180        ///   @see        CBPeripheralManagerAuthorizationStatus
181        ///  
182        ///
183        /// ```
184        #[deprecated = "Use CBManagerAuthorization instead"]
185        #[unsafe(method(authorizationStatus))]
186        #[unsafe(method_family = none)]
187        pub unsafe fn authorizationStatus() -> CBPeripheralManagerAuthorizationStatus;
188
189        #[unsafe(method(init))]
190        #[unsafe(method_family = init)]
191        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
192
193        #[cfg(feature = "dispatch2")]
194        /// Parameter `delegate`: The delegate that will receive peripheral role events.
195        ///
196        /// Parameter `queue`: The dispatch queue on which the events will be dispatched.
197        ///
198        ///
199        /// The initialization call. The events of the peripheral role will be dispatched on the provided queue.
200        /// If
201        /// <i>
202        /// nil
203        /// </i>
204        /// , the main queue will be used.
205        ///
206        /// # Safety
207        ///
208        /// `queue` possibly has additional threading requirements.
209        #[unsafe(method(initWithDelegate:queue:))]
210        #[unsafe(method_family = init)]
211        pub unsafe fn initWithDelegate_queue(
212            this: Allocated<Self>,
213            delegate: Option<&ProtocolObject<dyn CBPeripheralManagerDelegate>>,
214            queue: Option<&DispatchQueue>,
215        ) -> Retained<Self>;
216
217        #[cfg(feature = "dispatch2")]
218        /// Parameter `delegate`: The delegate that will receive peripheral role events.
219        ///
220        /// Parameter `queue`: The dispatch queue on which the events will be dispatched.
221        ///
222        /// Parameter `options`: An optional dictionary specifying options for the manager.
223        ///
224        ///
225        /// The initialization call. The events of the peripheral role will be dispatched on the provided queue.
226        /// If
227        /// <i>
228        /// nil
229        /// </i>
230        /// , the main queue will be used.
231        ///
232        ///
233        /// See also: CBPeripheralManagerOptionShowPowerAlertKey
234        ///
235        /// See also: CBPeripheralManagerOptionRestoreIdentifierKey
236        ///
237        /// # Safety
238        ///
239        /// - `queue` possibly has additional threading requirements.
240        /// - `options` generic should be of the correct type.
241        #[unsafe(method(initWithDelegate:queue:options:))]
242        #[unsafe(method_family = init)]
243        pub unsafe fn initWithDelegate_queue_options(
244            this: Allocated<Self>,
245            delegate: Option<&ProtocolObject<dyn CBPeripheralManagerDelegate>>,
246            queue: Option<&DispatchQueue>,
247            options: Option<&NSDictionary<NSString, AnyObject>>,
248        ) -> Retained<Self>;
249
250        /// Parameter `advertisementData`: An optional dictionary containing the data to be advertised.
251        ///
252        ///
253        /// Starts advertising. Supported advertising data types are
254        /// <code>
255        /// CBAdvertisementDataLocalNameKey
256        /// </code>
257        /// and
258        /// <code>
259        /// CBAdvertisementDataServiceUUIDsKey
260        /// </code>
261        /// .
262        /// When in the foreground, an application can utilize up to 28 bytes of space in the initial advertisement data for
263        /// any combination of the supported advertising data types. If this space is used up, there are an additional 10 bytes of
264        /// space in the scan response that can be used only for the local name. Note that these sizes do not include the 2 bytes
265        /// of header information that are required for each new data type. Any service UUIDs that do not fit in the allotted space
266        /// will be added to a special "overflow" area, and can only be discovered by an iOS device that is explicitly scanning
267        /// for them.
268        /// While an application is in the background, the local name will not be used and all service UUIDs will be placed in the
269        /// "overflow" area. However, applications that have not specified the "bluetooth-peripheral" background mode will not be able
270        /// to advertise anything while in the background.
271        ///
272        ///
273        /// See: peripheralManagerDidStartAdvertising:error:
274        ///
275        /// See also: CBAdvertisementData.h
276        ///
277        /// # Safety
278        ///
279        /// `advertisement_data` generic should be of the correct type.
280        #[unsafe(method(startAdvertising:))]
281        #[unsafe(method_family = none)]
282        pub unsafe fn startAdvertising(
283            &self,
284            advertisement_data: Option<&NSDictionary<NSString, AnyObject>>,
285        );
286
287        /// Stops advertising.
288        #[unsafe(method(stopAdvertising))]
289        #[unsafe(method_family = none)]
290        pub unsafe fn stopAdvertising(&self);
291
292        #[cfg(all(feature = "CBCentral", feature = "CBPeer"))]
293        /// Parameter `latency`: The desired connection latency.
294        ///
295        /// Parameter `central`: A connected central.
296        ///
297        ///
298        /// Sets the desired connection latency for an existing connection to
299        /// <i>
300        /// central
301        /// </i>
302        /// . Connection latency changes are not guaranteed, so the
303        /// resultant latency may vary. If a desired latency is not set, the latency chosen by
304        /// <i>
305        /// central
306        /// </i>
307        /// at the time of connection establishment
308        /// will be used. Typically, it is not necessary to change the latency.
309        ///
310        ///
311        /// See: CBPeripheralManagerConnectionLatency
312        #[unsafe(method(setDesiredConnectionLatency:forCentral:))]
313        #[unsafe(method_family = none)]
314        pub unsafe fn setDesiredConnectionLatency_forCentral(
315            &self,
316            latency: CBPeripheralManagerConnectionLatency,
317            central: &CBCentral,
318        );
319
320        #[cfg(all(feature = "CBAttribute", feature = "CBService"))]
321        /// Parameter `service`: A GATT service.
322        ///
323        ///
324        /// Publishes a service and its associated characteristic(s) to the local database. If the service contains included services,
325        /// they must be published first.
326        ///
327        ///
328        /// See: peripheralManager:didAddService:error:
329        #[unsafe(method(addService:))]
330        #[unsafe(method_family = none)]
331        pub unsafe fn addService(&self, service: &CBMutableService);
332
333        #[cfg(all(feature = "CBAttribute", feature = "CBService"))]
334        /// Parameter `service`: A GATT service.
335        ///
336        ///
337        /// Removes a published service from the local database. If the service is included by other service(s), they must be removed
338        /// first.
339        #[unsafe(method(removeService:))]
340        #[unsafe(method_family = none)]
341        pub unsafe fn removeService(&self, service: &CBMutableService);
342
343        /// Removes all published services from the local database.
344        #[unsafe(method(removeAllServices))]
345        #[unsafe(method_family = none)]
346        pub unsafe fn removeAllServices(&self);
347
348        #[cfg(all(feature = "CBATTRequest", feature = "CBError"))]
349        /// Parameter `request`: The original request that was received from the central.
350        ///
351        /// Parameter `result`: The result of attempting to fulfill
352        /// <i>
353        /// request
354        /// </i>
355        /// .
356        ///
357        ///
358        /// Used to respond to request(s) received via the
359        ///
360        /// ```text
361        ///  peripheralManager:didReceiveReadRequest:
362        /// ```
363        ///
364        /// or
365        ///
366        /// ```text
367        ///  peripheralManager:didReceiveWriteRequests:
368        /// ```
369        ///
370        /// delegate methods.
371        ///
372        ///
373        /// See: peripheralManager:didReceiveReadRequest:
374        ///
375        /// See: peripheralManager:didReceiveWriteRequests:
376        #[unsafe(method(respondToRequest:withResult:))]
377        #[unsafe(method_family = none)]
378        pub unsafe fn respondToRequest_withResult(
379            &self,
380            request: &CBATTRequest,
381            result: CBATTError,
382        );
383
384        #[cfg(all(
385            feature = "CBAttribute",
386            feature = "CBCentral",
387            feature = "CBCharacteristic",
388            feature = "CBPeer"
389        ))]
390        /// Parameter `value`: The value to be sent via a notification/indication.
391        ///
392        /// Parameter `characteristic`: The characteristic whose value has changed.
393        ///
394        /// Parameter `centrals`: A list of
395        /// <code>
396        /// CBCentral
397        /// </code>
398        /// objects to receive the update. Note that centrals which have not subscribed to
399        /// <i>
400        /// characteristic
401        /// </i>
402        /// will be ignored. If
403        /// <i>
404        /// nil
405        /// </i>
406        /// , all centrals that are subscribed to
407        /// <i>
408        /// characteristic
409        /// </i>
410        /// will be updated.
411        ///
412        ///
413        /// Sends an updated characteristic value to one or more centrals, via a notification or indication. If
414        /// <i>
415        /// value
416        /// </i>
417        /// exceeds
418        /// {
419        ///
420        /// ```text
421        ///  maximumUpdateValueLength}, it will be truncated to fit.
422        ///
423        ///   @return                 <i>YES</i> if the update could be sent, or <i>NO</i> if the underlying transmit queue is full. If <i>NO</i> was returned,
424        ///                           the delegate method @link peripheralManagerIsReadyToUpdateSubscribers:
425        /// ```
426        ///
427        /// will be called once space has become
428        /// available, and the update should be re-sent if so desired.
429        ///
430        ///
431        /// See: peripheralManager:central:didSubscribeToCharacteristic:
432        ///
433        /// See: peripheralManager:central:didUnsubscribeFromCharacteristic:
434        ///
435        /// See: peripheralManagerIsReadyToUpdateSubscribers:
436        ///
437        /// See also: maximumUpdateValueLength
438        #[unsafe(method(updateValue:forCharacteristic:onSubscribedCentrals:))]
439        #[unsafe(method_family = none)]
440        pub unsafe fn updateValue_forCharacteristic_onSubscribedCentrals(
441            &self,
442            value: &NSData,
443            characteristic: &CBMutableCharacteristic,
444            centrals: Option<&NSArray<CBCentral>>,
445        ) -> bool;
446
447        /// Parameter `encryptionRequired`: YES if the service requires the link to be encrypted before a stream can be established.  NO if the service can be used over
448        /// an unsecured link.
449        ///
450        ///
451        /// Create a listener for incoming L2CAP Channel connections.  The system will determine an unused PSM at the time of publishing, which will be returned
452        /// with
453        ///
454        /// ```text
455        ///  peripheralManager:didPublishL2CAPChannel:error:
456        /// ```
457        ///
458        /// .  L2CAP Channels are not discoverable by themselves, so it is the application's
459        /// responsibility to handle PSM discovery on the client.
460        #[unsafe(method(publishL2CAPChannelWithEncryption:))]
461        #[unsafe(method_family = none)]
462        pub unsafe fn publishL2CAPChannelWithEncryption(&self, encryption_required: bool);
463
464        #[cfg(feature = "CBL2CAPChannel")]
465        /// Parameter `PSM`: The service PSM to be removed from the system.
466        ///
467        ///
468        /// Removes a published service from the local system.  No new connections for this PSM will be accepted, and any existing L2CAP channels
469        /// using this PSM will be closed.
470        #[unsafe(method(unpublishL2CAPChannel:))]
471        #[unsafe(method_family = none)]
472        pub unsafe fn unpublishL2CAPChannel(&self, psm: CBL2CAPPSM);
473    );
474}
475
476/// Methods declared on superclass `NSObject`.
477#[cfg(feature = "CBManager")]
478impl CBPeripheralManager {
479    extern_methods!(
480        #[unsafe(method(new))]
481        #[unsafe(method_family = new)]
482        pub unsafe fn new() -> Retained<Self>;
483    );
484}
485
486extern_protocol!(
487    /// The delegate of a
488    ///
489    /// ```text
490    ///  CBPeripheralManager
491    /// ```
492    ///
493    /// object must adopt the
494    /// <code>
495    /// CBPeripheralManagerDelegate
496    /// </code>
497    /// protocol. The
498    /// single required method indicates the availability of the peripheral manager, while the optional methods provide information about
499    /// centrals, which can connect and access the local database.
500    ///
501    /// See also [Apple's documentation](https://developer.apple.com/documentation/corebluetooth/cbperipheralmanagerdelegate?language=objc)
502    pub unsafe trait CBPeripheralManagerDelegate: NSObjectProtocol {
503        #[cfg(feature = "CBManager")]
504        /// Parameter `peripheral`: The peripheral manager whose state has changed.
505        ///
506        ///
507        /// Invoked whenever the peripheral manager's state has been updated. Commands should only be issued when the state is
508        /// <code>
509        /// CBPeripheralManagerStatePoweredOn
510        /// </code>
511        /// . A state below
512        /// <code>
513        /// CBPeripheralManagerStatePoweredOn
514        /// </code>
515        /// implies that advertisement has paused and any connected centrals have been disconnected. If the state moves below
516        /// <code>
517        /// CBPeripheralManagerStatePoweredOff
518        /// </code>
519        /// , advertisement is stopped and must be explicitly restarted, and the
520        /// local database is cleared and all services must be re-added.
521        ///
522        ///
523        /// See: state
524        #[unsafe(method(peripheralManagerDidUpdateState:))]
525        #[unsafe(method_family = none)]
526        unsafe fn peripheralManagerDidUpdateState(&self, peripheral: &CBPeripheralManager);
527
528        #[cfg(feature = "CBManager")]
529        /// Parameter `peripheral`: The peripheral manager providing this information.
530        ///
531        /// Parameter `dict`: A dictionary containing information about
532        /// <i>
533        /// peripheral
534        /// </i>
535        /// that was preserved by the system at the time the app was terminated.
536        ///
537        ///
538        /// For apps that opt-in to state preservation and restoration, this is the first method invoked when your app is relaunched into
539        /// the background to complete some Bluetooth-related task. Use this method to synchronize your app's state with the state of the
540        /// Bluetooth system.
541        ///
542        ///
543        /// See also: CBPeripheralManagerRestoredStateServicesKey;
544        ///
545        /// See also: CBPeripheralManagerRestoredStateAdvertisementDataKey;
546        ///
547        /// # Safety
548        ///
549        /// `dict` generic should be of the correct type.
550        #[optional]
551        #[unsafe(method(peripheralManager:willRestoreState:))]
552        #[unsafe(method_family = none)]
553        unsafe fn peripheralManager_willRestoreState(
554            &self,
555            peripheral: &CBPeripheralManager,
556            dict: &NSDictionary<NSString, AnyObject>,
557        );
558
559        #[cfg(feature = "CBManager")]
560        /// Parameter `peripheral`: The peripheral manager providing this information.
561        ///
562        /// Parameter `error`: If an error occurred, the cause of the failure.
563        ///
564        ///
565        /// This method returns the result of a
566        ///
567        /// ```text
568        ///  startAdvertising:
569        /// ```
570        ///
571        /// call. If advertisement could
572        /// not be started, the cause will be detailed in the
573        /// <i>
574        /// error
575        /// </i>
576        /// parameter.
577        #[optional]
578        #[unsafe(method(peripheralManagerDidStartAdvertising:error:))]
579        #[unsafe(method_family = none)]
580        unsafe fn peripheralManagerDidStartAdvertising_error(
581            &self,
582            peripheral: &CBPeripheralManager,
583            error: Option<&NSError>,
584        );
585
586        #[cfg(all(feature = "CBAttribute", feature = "CBManager", feature = "CBService"))]
587        /// Parameter `peripheral`: The peripheral manager providing this information.
588        ///
589        /// Parameter `service`: The service that was added to the local database.
590        ///
591        /// Parameter `error`: If an error occurred, the cause of the failure.
592        ///
593        ///
594        /// This method returns the result of an
595        ///
596        /// ```text
597        ///  addService:
598        /// ```
599        ///
600        /// call. If the service could
601        /// not be published to the local database, the cause will be detailed in the
602        /// <i>
603        /// error
604        /// </i>
605        /// parameter.
606        #[optional]
607        #[unsafe(method(peripheralManager:didAddService:error:))]
608        #[unsafe(method_family = none)]
609        unsafe fn peripheralManager_didAddService_error(
610            &self,
611            peripheral: &CBPeripheralManager,
612            service: &CBService,
613            error: Option<&NSError>,
614        );
615
616        #[cfg(all(
617            feature = "CBAttribute",
618            feature = "CBCentral",
619            feature = "CBCharacteristic",
620            feature = "CBManager",
621            feature = "CBPeer"
622        ))]
623        /// Parameter `peripheral`: The peripheral manager providing this update.
624        ///
625        /// Parameter `central`: The central that issued the command.
626        ///
627        /// Parameter `characteristic`: The characteristic on which notifications or indications were enabled.
628        ///
629        ///
630        /// This method is invoked when a central configures
631        /// <i>
632        /// characteristic
633        /// </i>
634        /// to notify or indicate.
635        /// It should be used as a cue to start sending updates as the characteristic value changes.
636        #[optional]
637        #[unsafe(method(peripheralManager:central:didSubscribeToCharacteristic:))]
638        #[unsafe(method_family = none)]
639        unsafe fn peripheralManager_central_didSubscribeToCharacteristic(
640            &self,
641            peripheral: &CBPeripheralManager,
642            central: &CBCentral,
643            characteristic: &CBCharacteristic,
644        );
645
646        #[cfg(all(
647            feature = "CBAttribute",
648            feature = "CBCentral",
649            feature = "CBCharacteristic",
650            feature = "CBManager",
651            feature = "CBPeer"
652        ))]
653        /// Parameter `peripheral`: The peripheral manager providing this update.
654        ///
655        /// Parameter `central`: The central that issued the command.
656        ///
657        /// Parameter `characteristic`: The characteristic on which notifications or indications were disabled.
658        ///
659        ///
660        /// This method is invoked when a central removes notifications/indications from
661        /// <i>
662        /// characteristic
663        /// </i>
664        /// .
665        #[optional]
666        #[unsafe(method(peripheralManager:central:didUnsubscribeFromCharacteristic:))]
667        #[unsafe(method_family = none)]
668        unsafe fn peripheralManager_central_didUnsubscribeFromCharacteristic(
669            &self,
670            peripheral: &CBPeripheralManager,
671            central: &CBCentral,
672            characteristic: &CBCharacteristic,
673        );
674
675        #[cfg(all(feature = "CBATTRequest", feature = "CBManager"))]
676        /// Parameter `peripheral`: The peripheral manager requesting this information.
677        ///
678        /// Parameter `request`: A
679        /// <code>
680        /// CBATTRequest
681        /// </code>
682        /// object.
683        ///
684        ///
685        /// This method is invoked when
686        /// <i>
687        /// peripheral
688        /// </i>
689        /// receives an ATT request for a characteristic with a dynamic value.
690        /// For every invocation of this method,
691        ///
692        /// ```text
693        ///  respondToRequest:withResult:
694        /// ```
695        ///
696        /// must be called.
697        ///
698        ///
699        /// See: CBATTRequest
700        #[optional]
701        #[unsafe(method(peripheralManager:didReceiveReadRequest:))]
702        #[unsafe(method_family = none)]
703        unsafe fn peripheralManager_didReceiveReadRequest(
704            &self,
705            peripheral: &CBPeripheralManager,
706            request: &CBATTRequest,
707        );
708
709        #[cfg(all(feature = "CBATTRequest", feature = "CBManager"))]
710        /// Parameter `peripheral`: The peripheral manager requesting this information.
711        ///
712        /// Parameter `requests`: A list of one or more
713        /// <code>
714        /// CBATTRequest
715        /// </code>
716        /// objects.
717        ///
718        ///
719        /// This method is invoked when
720        /// <i>
721        /// peripheral
722        /// </i>
723        /// receives an ATT request or command for one or more characteristics with a dynamic value.
724        /// For every invocation of this method,
725        ///
726        /// ```text
727        ///  respondToRequest:withResult:
728        /// ```
729        ///
730        /// should be called exactly once. If
731        /// <i>
732        /// requests
733        /// </i>
734        /// contains
735        /// multiple requests, they must be treated as an atomic unit. If the execution of one of the requests would cause a failure, the request
736        /// and error reason should be provided to
737        /// <code>
738        /// respondToRequest:withResult:
739        /// </code>
740        /// and none of the requests should be executed.
741        ///
742        ///
743        /// See: CBATTRequest
744        #[optional]
745        #[unsafe(method(peripheralManager:didReceiveWriteRequests:))]
746        #[unsafe(method_family = none)]
747        unsafe fn peripheralManager_didReceiveWriteRequests(
748            &self,
749            peripheral: &CBPeripheralManager,
750            requests: &NSArray<CBATTRequest>,
751        );
752
753        #[cfg(feature = "CBManager")]
754        /// Parameter `peripheral`: The peripheral manager providing this update.
755        ///
756        ///
757        /// This method is invoked after a failed call to
758        ///
759        /// ```text
760        ///  updateValue:forCharacteristic:onSubscribedCentrals:
761        /// ```
762        ///
763        /// , when
764        /// <i>
765        /// peripheral
766        /// </i>
767        /// is again
768        /// ready to send characteristic value updates.
769        #[optional]
770        #[unsafe(method(peripheralManagerIsReadyToUpdateSubscribers:))]
771        #[unsafe(method_family = none)]
772        unsafe fn peripheralManagerIsReadyToUpdateSubscribers(
773            &self,
774            peripheral: &CBPeripheralManager,
775        );
776
777        #[cfg(all(feature = "CBL2CAPChannel", feature = "CBManager"))]
778        /// Parameter `peripheral`: The peripheral manager requesting this information.
779        ///
780        /// Parameter `PSM`: The PSM of the channel that was published.
781        ///
782        /// Parameter `error`: If an error occurred, the cause of the failure.
783        ///
784        ///
785        /// This method is the response to a
786        ///
787        /// ```text
788        ///  publishL2CAPChannel:
789        /// ```
790        ///
791        /// call.  The PSM will contain the PSM that was assigned for the published
792        /// channel
793        #[optional]
794        #[unsafe(method(peripheralManager:didPublishL2CAPChannel:error:))]
795        #[unsafe(method_family = none)]
796        unsafe fn peripheralManager_didPublishL2CAPChannel_error(
797            &self,
798            peripheral: &CBPeripheralManager,
799            psm: CBL2CAPPSM,
800            error: Option<&NSError>,
801        );
802
803        #[cfg(all(feature = "CBL2CAPChannel", feature = "CBManager"))]
804        /// Parameter `peripheral`: The peripheral manager requesting this information.
805        ///
806        /// Parameter `PSM`: The PSM of the channel that was published.
807        ///
808        /// Parameter `error`: If an error occurred, the cause of the failure.
809        ///
810        ///
811        /// This method is the response to a
812        ///
813        /// ```text
814        ///  unpublishL2CAPChannel:
815        /// ```
816        ///
817        /// call.
818        #[optional]
819        #[unsafe(method(peripheralManager:didUnpublishL2CAPChannel:error:))]
820        #[unsafe(method_family = none)]
821        unsafe fn peripheralManager_didUnpublishL2CAPChannel_error(
822            &self,
823            peripheral: &CBPeripheralManager,
824            psm: CBL2CAPPSM,
825            error: Option<&NSError>,
826        );
827
828        #[cfg(all(feature = "CBL2CAPChannel", feature = "CBManager"))]
829        /// Parameter `peripheral`: The peripheral manager requesting this information.
830        ///
831        /// Parameter `channel`: A
832        /// <code>
833        /// CBL2CAPChannel
834        /// </code>
835        /// object.
836        ///
837        /// Parameter `error`: If an error occurred, the cause of the failure.
838        ///
839        ///
840        /// This method returns the result of establishing an incoming L2CAP channel , following publishing a channel using
841        ///
842        /// ```text
843        ///  publishL2CAPChannel: @link call.
844        ///
845        ///  
846        ///
847        /// ```
848        #[optional]
849        #[unsafe(method(peripheralManager:didOpenL2CAPChannel:error:))]
850        #[unsafe(method_family = none)]
851        unsafe fn peripheralManager_didOpenL2CAPChannel_error(
852            &self,
853            peripheral: &CBPeripheralManager,
854            channel: Option<&CBL2CAPChannel>,
855            error: Option<&NSError>,
856        );
857    }
858);