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