objc2_core_bluetooth/generated/
CBPeripheral.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 connection state of a CBPeripheral.
11///
12/// See also [Apple's documentation](https://developer.apple.com/documentation/corebluetooth/cbperipheralstate?language=objc)
13// NS_ENUM
14#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct CBPeripheralState(pub NSInteger);
17impl CBPeripheralState {
18    #[doc(alias = "CBPeripheralStateDisconnected")]
19    pub const Disconnected: Self = Self(0);
20    #[doc(alias = "CBPeripheralStateConnecting")]
21    pub const Connecting: Self = Self(1);
22    #[doc(alias = "CBPeripheralStateConnected")]
23    pub const Connected: Self = Self(2);
24    #[doc(alias = "CBPeripheralStateDisconnecting")]
25    pub const Disconnecting: Self = Self(3);
26}
27
28unsafe impl Encode for CBPeripheralState {
29    const ENCODING: Encoding = NSInteger::ENCODING;
30}
31
32unsafe impl RefEncode for CBPeripheralState {
33    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
34}
35
36/// Specifies which type of write is to be performed on a CBCharacteristic.
37///
38/// See also [Apple's documentation](https://developer.apple.com/documentation/corebluetooth/cbcharacteristicwritetype?language=objc)
39// NS_ENUM
40#[repr(transparent)]
41#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
42pub struct CBCharacteristicWriteType(pub NSInteger);
43impl CBCharacteristicWriteType {
44    #[doc(alias = "CBCharacteristicWriteWithResponse")]
45    pub const WithResponse: Self = Self(0);
46    #[doc(alias = "CBCharacteristicWriteWithoutResponse")]
47    pub const WithoutResponse: Self = Self(1);
48}
49
50unsafe impl Encode for CBCharacteristicWriteType {
51    const ENCODING: Encoding = NSInteger::ENCODING;
52}
53
54unsafe impl RefEncode for CBCharacteristicWriteType {
55    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
56}
57
58extern_class!(
59    /// Represents a peripheral.
60    ///
61    /// See also [Apple's documentation](https://developer.apple.com/documentation/corebluetooth/cbperipheral?language=objc)
62    #[unsafe(super(CBPeer, NSObject))]
63    #[derive(Debug, PartialEq, Eq, Hash)]
64    #[cfg(feature = "CBPeer")]
65    pub struct CBPeripheral;
66);
67
68#[cfg(feature = "CBPeer")]
69extern_conformance!(
70    unsafe impl NSCopying for CBPeripheral {}
71);
72
73#[cfg(feature = "CBPeer")]
74unsafe impl CopyingHelper for CBPeripheral {
75    type Result = Self;
76}
77
78#[cfg(feature = "CBPeer")]
79extern_conformance!(
80    unsafe impl NSObjectProtocol for CBPeripheral {}
81);
82
83#[cfg(feature = "CBPeer")]
84impl CBPeripheral {
85    extern_methods!(
86        /// The delegate object that will receive peripheral events.
87        #[unsafe(method(delegate))]
88        #[unsafe(method_family = none)]
89        pub unsafe fn delegate(&self)
90            -> Option<Retained<ProtocolObject<dyn CBPeripheralDelegate>>>;
91
92        /// Setter for [`delegate`][Self::delegate].
93        ///
94        /// This is a [weak property][objc2::topics::weak_property].
95        #[unsafe(method(setDelegate:))]
96        #[unsafe(method_family = none)]
97        pub unsafe fn setDelegate(
98            &self,
99            delegate: Option<&ProtocolObject<dyn CBPeripheralDelegate>>,
100        );
101
102        /// The name of the peripheral.
103        #[unsafe(method(name))]
104        #[unsafe(method_family = none)]
105        pub unsafe fn name(&self) -> Option<Retained<NSString>>;
106
107        /// The most recently read RSSI, in decibels.
108        ///
109        ///
110        /// ```text
111        ///  peripheral:didReadRSSI:error:} instead.
112        ///  
113        ///
114        /// ```
115        #[deprecated]
116        #[unsafe(method(RSSI))]
117        #[unsafe(method_family = none)]
118        pub unsafe fn RSSI(&self) -> Option<Retained<NSNumber>>;
119
120        /// The current connection state of the peripheral.
121        #[unsafe(method(state))]
122        #[unsafe(method_family = none)]
123        pub unsafe fn state(&self) -> CBPeripheralState;
124
125        #[cfg(all(feature = "CBAttribute", feature = "CBService"))]
126        /// A list of
127        /// <code>
128        /// CBService
129        /// </code>
130        /// objects that have been discovered on the peripheral.
131        #[unsafe(method(services))]
132        #[unsafe(method_family = none)]
133        pub unsafe fn services(&self) -> Option<Retained<NSArray<CBService>>>;
134
135        /// YES if the remote device has space to send a write without response. If this value is NO,
136        /// the value will be set to YES after the current writes have been flushed, and
137        /// <link
138        /// >peripheralIsReadyToSendWriteWithoutResponse:
139        /// </link
140        /// > will be called.
141        #[unsafe(method(canSendWriteWithoutResponse))]
142        #[unsafe(method_family = none)]
143        pub unsafe fn canSendWriteWithoutResponse(&self) -> bool;
144
145        /// YES if the remote device has been authorized to receive data over ANCS (Apple Notification Service Center) protocol.  If this value is NO,
146        /// the value will be set to YES after a user authorization occurs and
147        /// <link
148        /// >didUpdateANCSAuthorizationForPeripheral:
149        /// </link
150        /// > will be called.
151        #[unsafe(method(ancsAuthorized))]
152        #[unsafe(method_family = none)]
153        pub unsafe fn ancsAuthorized(&self) -> bool;
154
155        /// While connected, retrieves the current RSSI of the link.
156        ///
157        ///
158        /// See: peripheral:didReadRSSI:error:
159        #[unsafe(method(readRSSI))]
160        #[unsafe(method_family = none)]
161        pub unsafe fn readRSSI(&self);
162
163        #[cfg(feature = "CBUUID")]
164        /// Parameter `serviceUUIDs`: A list of
165        /// <code>
166        /// CBUUID
167        /// </code>
168        /// objects representing the service types to be discovered. If
169        /// <i>
170        /// nil
171        /// </i>
172        /// ,
173        /// all services will be discovered.
174        ///
175        ///
176        /// Discovers available service(s) on the peripheral.
177        ///
178        ///
179        /// See: peripheral:didDiscoverServices:
180        #[unsafe(method(discoverServices:))]
181        #[unsafe(method_family = none)]
182        pub unsafe fn discoverServices(&self, service_uui_ds: Option<&NSArray<CBUUID>>);
183
184        #[cfg(all(feature = "CBAttribute", feature = "CBService", feature = "CBUUID"))]
185        /// Parameter `includedServiceUUIDs`: A list of
186        /// <code>
187        /// CBUUID
188        /// </code>
189        /// objects representing the included service types to be discovered. If
190        /// <i>
191        /// nil
192        /// </i>
193        /// ,
194        /// all of
195        /// <i>
196        /// service
197        /// </i>
198        /// s included services will be discovered, which is considerably slower and not recommended.
199        ///
200        /// Parameter `service`: A GATT service.
201        ///
202        ///
203        /// Discovers the specified included service(s) of
204        /// <i>
205        /// service
206        /// </i>
207        /// .
208        ///
209        ///
210        /// See: peripheral:didDiscoverIncludedServicesForService:error:
211        #[unsafe(method(discoverIncludedServices:forService:))]
212        #[unsafe(method_family = none)]
213        pub unsafe fn discoverIncludedServices_forService(
214            &self,
215            included_service_uui_ds: Option<&NSArray<CBUUID>>,
216            service: &CBService,
217        );
218
219        #[cfg(all(feature = "CBAttribute", feature = "CBService", feature = "CBUUID"))]
220        /// Parameter `characteristicUUIDs`: A list of
221        /// <code>
222        /// CBUUID
223        /// </code>
224        /// objects representing the characteristic types to be discovered. If
225        /// <i>
226        /// nil
227        /// </i>
228        /// ,
229        /// all characteristics of
230        /// <i>
231        /// service
232        /// </i>
233        /// will be discovered.
234        ///
235        /// Parameter `service`: A GATT service.
236        ///
237        ///
238        /// Discovers the specified characteristic(s) of
239        /// <i>
240        /// service
241        /// </i>
242        /// .
243        ///
244        ///
245        /// See: peripheral:didDiscoverCharacteristicsForService:error:
246        #[unsafe(method(discoverCharacteristics:forService:))]
247        #[unsafe(method_family = none)]
248        pub unsafe fn discoverCharacteristics_forService(
249            &self,
250            characteristic_uui_ds: Option<&NSArray<CBUUID>>,
251            service: &CBService,
252        );
253
254        #[cfg(all(feature = "CBAttribute", feature = "CBCharacteristic"))]
255        /// Parameter `characteristic`: A GATT characteristic.
256        ///
257        ///
258        /// Reads the characteristic value for
259        /// <i>
260        /// characteristic
261        /// </i>
262        /// .
263        ///
264        ///
265        /// See: peripheral:didUpdateValueForCharacteristic:error:
266        #[unsafe(method(readValueForCharacteristic:))]
267        #[unsafe(method_family = none)]
268        pub unsafe fn readValueForCharacteristic(&self, characteristic: &CBCharacteristic);
269
270        /// The maximum amount of data, in bytes, that can be sent to a characteristic in a single write type.
271        ///
272        ///
273        /// See: writeValue:forCharacteristic:type:
274        #[unsafe(method(maximumWriteValueLengthForType:))]
275        #[unsafe(method_family = none)]
276        pub unsafe fn maximumWriteValueLengthForType(
277            &self,
278            r#type: CBCharacteristicWriteType,
279        ) -> NSUInteger;
280
281        #[cfg(all(feature = "CBAttribute", feature = "CBCharacteristic"))]
282        /// Parameter `data`: The value to write.
283        ///
284        /// Parameter `characteristic`: The characteristic whose characteristic value will be written.
285        ///
286        /// Parameter `type`: The type of write to be executed.
287        ///
288        ///
289        /// Writes
290        /// <i>
291        /// value
292        /// </i>
293        /// to
294        /// <i>
295        /// characteristic
296        /// </i>
297        /// 's characteristic value.
298        /// If the
299        /// <code>
300        /// CBCharacteristicWriteWithResponse
301        /// </code>
302        /// type is specified, {
303        ///
304        /// ```text
305        ///  peripheral:didWriteValueForCharacteristic:error:}
306        ///                             is called with the result of the write request.
307        ///                             If the <code>CBCharacteristicWriteWithoutResponse</code> type is specified, and canSendWriteWithoutResponse is false, the delivery
308        ///                              of the data is best-effort and may not be guaranteed.
309        ///
310        ///   @see                    peripheral:didWriteValueForCharacteristic:error:
311        ///   @see                    peripheralIsReadyToSendWriteWithoutResponse:
312        ///     @see                    canSendWriteWithoutResponse
313        ///     @see                    CBCharacteristicWriteType
314        ///  
315        ///
316        /// ```
317        #[unsafe(method(writeValue:forCharacteristic:type:))]
318        #[unsafe(method_family = none)]
319        pub unsafe fn writeValue_forCharacteristic_type(
320            &self,
321            data: &NSData,
322            characteristic: &CBCharacteristic,
323            r#type: CBCharacteristicWriteType,
324        );
325
326        #[cfg(all(feature = "CBAttribute", feature = "CBCharacteristic"))]
327        /// Parameter `enabled`: Whether or not notifications/indications should be enabled.
328        ///
329        /// Parameter `characteristic`: The characteristic containing the client characteristic configuration descriptor.
330        ///
331        ///
332        /// Enables or disables notifications/indications for the characteristic value of
333        /// <i>
334        /// characteristic
335        /// </i>
336        /// . If
337        /// <i>
338        /// characteristic
339        /// </i>
340        /// allows both, notifications will be used.
341        /// When notifications/indications are enabled, updates to the characteristic value will be received via delegate method
342        ///
343        /// ```text
344        ///  peripheral:didUpdateValueForCharacteristic:error:
345        /// ```
346        ///
347        /// . Since it is the peripheral that chooses when to send an update,
348        /// the application should be prepared to handle them as long as notifications/indications remain enabled.
349        ///
350        ///
351        /// See: peripheral:didUpdateNotificationStateForCharacteristic:error:
352        ///
353        /// See also: CBConnectPeripheralOptionNotifyOnNotificationKey
354        #[unsafe(method(setNotifyValue:forCharacteristic:))]
355        #[unsafe(method_family = none)]
356        pub unsafe fn setNotifyValue_forCharacteristic(
357            &self,
358            enabled: bool,
359            characteristic: &CBCharacteristic,
360        );
361
362        #[cfg(all(feature = "CBAttribute", feature = "CBCharacteristic"))]
363        /// Parameter `characteristic`: A GATT characteristic.
364        ///
365        ///
366        /// Discovers the characteristic descriptor(s) of
367        /// <i>
368        /// characteristic
369        /// </i>
370        /// .
371        ///
372        ///
373        /// See: peripheral:didDiscoverDescriptorsForCharacteristic:error:
374        #[unsafe(method(discoverDescriptorsForCharacteristic:))]
375        #[unsafe(method_family = none)]
376        pub unsafe fn discoverDescriptorsForCharacteristic(
377            &self,
378            characteristic: &CBCharacteristic,
379        );
380
381        #[cfg(all(feature = "CBAttribute", feature = "CBDescriptor"))]
382        /// Parameter `descriptor`: A GATT characteristic descriptor.
383        ///
384        ///
385        /// Reads the value of
386        /// <i>
387        /// descriptor
388        /// </i>
389        /// .
390        ///
391        ///
392        /// See: peripheral:didUpdateValueForDescriptor:error:
393        #[unsafe(method(readValueForDescriptor:))]
394        #[unsafe(method_family = none)]
395        pub unsafe fn readValueForDescriptor(&self, descriptor: &CBDescriptor);
396
397        #[cfg(all(feature = "CBAttribute", feature = "CBDescriptor"))]
398        /// Parameter `data`: The value to write.
399        ///
400        /// Parameter `descriptor`: A GATT characteristic descriptor.
401        ///
402        ///
403        /// Writes
404        /// <i>
405        /// data
406        /// </i>
407        /// to
408        /// <i>
409        /// descriptor
410        /// </i>
411        /// 's value. Client characteristic configuration descriptors cannot be written using
412        /// this method, and should instead use
413        ///
414        /// ```text
415        ///  setNotifyValue:forCharacteristic:
416        /// ```
417        ///
418        /// .
419        ///
420        ///
421        /// See: peripheral:didWriteValueForCharacteristic:error:
422        #[unsafe(method(writeValue:forDescriptor:))]
423        #[unsafe(method_family = none)]
424        pub unsafe fn writeValue_forDescriptor(&self, data: &NSData, descriptor: &CBDescriptor);
425
426        #[cfg(feature = "CBL2CAPChannel")]
427        /// Parameter `PSM`: The PSM of the channel to open
428        ///
429        ///
430        /// Attempt to open an L2CAP channel to the peripheral using the supplied PSM.
431        ///
432        ///
433        /// See: peripheral:didWriteValueForCharacteristic:error:
434        #[unsafe(method(openL2CAPChannel:))]
435        #[unsafe(method_family = none)]
436        pub unsafe fn openL2CAPChannel(&self, psm: CBL2CAPPSM);
437    );
438}
439
440/// Methods declared on superclass `CBPeer`.
441#[cfg(feature = "CBPeer")]
442impl CBPeripheral {
443    extern_methods!(
444        #[unsafe(method(init))]
445        #[unsafe(method_family = init)]
446        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
447    );
448}
449
450/// Methods declared on superclass `NSObject`.
451#[cfg(feature = "CBPeer")]
452impl CBPeripheral {
453    extern_methods!(
454        #[unsafe(method(new))]
455        #[unsafe(method_family = new)]
456        pub unsafe fn new() -> Retained<Self>;
457    );
458}
459
460extern_protocol!(
461    /// Delegate for CBPeripheral.
462    ///
463    /// See also [Apple's documentation](https://developer.apple.com/documentation/corebluetooth/cbperipheraldelegate?language=objc)
464    pub unsafe trait CBPeripheralDelegate: NSObjectProtocol {
465        #[cfg(feature = "CBPeer")]
466        /// Parameter `peripheral`: The peripheral providing this update.
467        ///
468        ///
469        /// This method is invoked when the
470        ///
471        /// ```text
472        ///  name
473        /// ```
474        ///
475        /// of
476        /// <i>
477        /// peripheral
478        /// </i>
479        /// changes.
480        #[optional]
481        #[unsafe(method(peripheralDidUpdateName:))]
482        #[unsafe(method_family = none)]
483        unsafe fn peripheralDidUpdateName(&self, peripheral: &CBPeripheral);
484
485        #[cfg(all(feature = "CBAttribute", feature = "CBPeer", feature = "CBService"))]
486        /// Parameter `peripheral`: The peripheral providing this update.
487        ///
488        /// Parameter `invalidatedServices`: The services that have been invalidated
489        ///
490        ///
491        /// This method is invoked when the
492        ///
493        /// ```text
494        ///  services
495        /// ```
496        ///
497        /// of
498        /// <i>
499        /// peripheral
500        /// </i>
501        /// have been changed.
502        /// At this point, the designated
503        /// <code>
504        /// CBService
505        /// </code>
506        /// objects have been invalidated.
507        /// Services can be re-discovered via
508        ///
509        /// ```text
510        ///  discoverServices:
511        /// ```
512        ///
513        /// .
514        #[optional]
515        #[unsafe(method(peripheral:didModifyServices:))]
516        #[unsafe(method_family = none)]
517        unsafe fn peripheral_didModifyServices(
518            &self,
519            peripheral: &CBPeripheral,
520            invalidated_services: &NSArray<CBService>,
521        );
522
523        #[cfg(feature = "CBPeer")]
524        /// Parameter `peripheral`: The peripheral providing this update.
525        ///
526        /// Parameter `error`: If an error occurred, the cause of the failure.
527        ///
528        ///
529        /// This method returns the result of a
530        ///
531        /// ```text
532        ///  readRSSI:
533        /// ```
534        ///
535        /// call.
536        ///
537        ///
538        /// ```text
539        ///  peripheral:didReadRSSI:error:} instead.
540        ///  
541        ///
542        /// ```
543        #[deprecated]
544        #[optional]
545        #[unsafe(method(peripheralDidUpdateRSSI:error:))]
546        #[unsafe(method_family = none)]
547        unsafe fn peripheralDidUpdateRSSI_error(
548            &self,
549            peripheral: &CBPeripheral,
550            error: Option<&NSError>,
551        );
552
553        #[cfg(feature = "CBPeer")]
554        /// Parameter `peripheral`: The peripheral providing this update.
555        ///
556        /// Parameter `RSSI`: The current RSSI of the link.
557        ///
558        /// Parameter `error`: If an error occurred, the cause of the failure.
559        ///
560        ///
561        /// This method returns the result of a
562        ///
563        /// ```text
564        ///  readRSSI:
565        /// ```
566        ///
567        /// call.
568        #[optional]
569        #[unsafe(method(peripheral:didReadRSSI:error:))]
570        #[unsafe(method_family = none)]
571        unsafe fn peripheral_didReadRSSI_error(
572            &self,
573            peripheral: &CBPeripheral,
574            rssi: &NSNumber,
575            error: Option<&NSError>,
576        );
577
578        #[cfg(feature = "CBPeer")]
579        /// Parameter `peripheral`: The peripheral providing this information.
580        ///
581        /// Parameter `error`: If an error occurred, the cause of the failure.
582        ///
583        ///
584        /// This method returns the result of a
585        ///
586        /// ```text
587        ///  discoverServices:
588        /// ```
589        ///
590        /// call. If the service(s) were read successfully, they can be retrieved via
591        /// <i>
592        /// peripheral
593        /// </i>
594        /// 's
595        ///
596        /// ```text
597        ///  services
598        /// ```
599        ///
600        /// property.
601        #[optional]
602        #[unsafe(method(peripheral:didDiscoverServices:))]
603        #[unsafe(method_family = none)]
604        unsafe fn peripheral_didDiscoverServices(
605            &self,
606            peripheral: &CBPeripheral,
607            error: Option<&NSError>,
608        );
609
610        #[cfg(all(feature = "CBAttribute", feature = "CBPeer", feature = "CBService"))]
611        /// Parameter `peripheral`: The peripheral providing this information.
612        ///
613        /// Parameter `service`: The
614        /// <code>
615        /// CBService
616        /// </code>
617        /// object containing the included services.
618        ///
619        /// Parameter `error`: If an error occurred, the cause of the failure.
620        ///
621        ///
622        /// This method returns the result of a
623        ///
624        /// ```text
625        ///  discoverIncludedServices:forService:
626        /// ```
627        ///
628        /// call. If the included service(s) were read successfully,
629        /// they can be retrieved via
630        /// <i>
631        /// service
632        /// </i>
633        /// 's
634        /// <code>
635        /// includedServices
636        /// </code>
637        /// property.
638        #[optional]
639        #[unsafe(method(peripheral:didDiscoverIncludedServicesForService:error:))]
640        #[unsafe(method_family = none)]
641        unsafe fn peripheral_didDiscoverIncludedServicesForService_error(
642            &self,
643            peripheral: &CBPeripheral,
644            service: &CBService,
645            error: Option<&NSError>,
646        );
647
648        #[cfg(all(feature = "CBAttribute", feature = "CBPeer", feature = "CBService"))]
649        /// Parameter `peripheral`: The peripheral providing this information.
650        ///
651        /// Parameter `service`: The
652        /// <code>
653        /// CBService
654        /// </code>
655        /// object containing the characteristic(s).
656        ///
657        /// Parameter `error`: If an error occurred, the cause of the failure.
658        ///
659        ///
660        /// This method returns the result of a
661        ///
662        /// ```text
663        ///  discoverCharacteristics:forService:
664        /// ```
665        ///
666        /// call. If the characteristic(s) were read successfully,
667        /// they can be retrieved via
668        /// <i>
669        /// service
670        /// </i>
671        /// 's
672        /// <code>
673        /// characteristics
674        /// </code>
675        /// property.
676        #[optional]
677        #[unsafe(method(peripheral:didDiscoverCharacteristicsForService:error:))]
678        #[unsafe(method_family = none)]
679        unsafe fn peripheral_didDiscoverCharacteristicsForService_error(
680            &self,
681            peripheral: &CBPeripheral,
682            service: &CBService,
683            error: Option<&NSError>,
684        );
685
686        #[cfg(all(
687            feature = "CBAttribute",
688            feature = "CBCharacteristic",
689            feature = "CBPeer"
690        ))]
691        /// Parameter `peripheral`: The peripheral providing this information.
692        ///
693        /// Parameter `characteristic`: A
694        /// <code>
695        /// CBCharacteristic
696        /// </code>
697        /// object.
698        ///
699        /// Parameter `error`: If an error occurred, the cause of the failure.
700        ///
701        ///
702        /// This method is invoked after a
703        ///
704        /// ```text
705        ///  readValueForCharacteristic:
706        /// ```
707        ///
708        /// call, or upon receipt of a notification/indication.
709        #[optional]
710        #[unsafe(method(peripheral:didUpdateValueForCharacteristic:error:))]
711        #[unsafe(method_family = none)]
712        unsafe fn peripheral_didUpdateValueForCharacteristic_error(
713            &self,
714            peripheral: &CBPeripheral,
715            characteristic: &CBCharacteristic,
716            error: Option<&NSError>,
717        );
718
719        #[cfg(all(
720            feature = "CBAttribute",
721            feature = "CBCharacteristic",
722            feature = "CBPeer"
723        ))]
724        /// Parameter `peripheral`: The peripheral providing this information.
725        ///
726        /// Parameter `characteristic`: A
727        /// <code>
728        /// CBCharacteristic
729        /// </code>
730        /// object.
731        ///
732        /// Parameter `error`: If an error occurred, the cause of the failure.
733        ///
734        ///
735        /// This method returns the result of a {
736        ///
737        /// ```text
738        ///  writeValue:forCharacteristic:type:} call, when the <code>CBCharacteristicWriteWithResponse</code> type is used.
739        ///  
740        ///
741        /// ```
742        #[optional]
743        #[unsafe(method(peripheral:didWriteValueForCharacteristic:error:))]
744        #[unsafe(method_family = none)]
745        unsafe fn peripheral_didWriteValueForCharacteristic_error(
746            &self,
747            peripheral: &CBPeripheral,
748            characteristic: &CBCharacteristic,
749            error: Option<&NSError>,
750        );
751
752        #[cfg(all(
753            feature = "CBAttribute",
754            feature = "CBCharacteristic",
755            feature = "CBPeer"
756        ))]
757        /// Parameter `peripheral`: The peripheral providing this information.
758        ///
759        /// Parameter `characteristic`: A
760        /// <code>
761        /// CBCharacteristic
762        /// </code>
763        /// object.
764        ///
765        /// Parameter `error`: If an error occurred, the cause of the failure.
766        ///
767        ///
768        /// This method returns the result of a
769        ///
770        /// ```text
771        ///  setNotifyValue:forCharacteristic:
772        /// ```
773        ///
774        /// call.
775        #[optional]
776        #[unsafe(method(peripheral:didUpdateNotificationStateForCharacteristic:error:))]
777        #[unsafe(method_family = none)]
778        unsafe fn peripheral_didUpdateNotificationStateForCharacteristic_error(
779            &self,
780            peripheral: &CBPeripheral,
781            characteristic: &CBCharacteristic,
782            error: Option<&NSError>,
783        );
784
785        #[cfg(all(
786            feature = "CBAttribute",
787            feature = "CBCharacteristic",
788            feature = "CBPeer"
789        ))]
790        /// Parameter `peripheral`: The peripheral providing this information.
791        ///
792        /// Parameter `characteristic`: A
793        /// <code>
794        /// CBCharacteristic
795        /// </code>
796        /// object.
797        ///
798        /// Parameter `error`: If an error occurred, the cause of the failure.
799        ///
800        ///
801        /// This method returns the result of a
802        ///
803        /// ```text
804        ///  discoverDescriptorsForCharacteristic:
805        /// ```
806        ///
807        /// call. If the descriptors were read successfully,
808        /// they can be retrieved via
809        /// <i>
810        /// characteristic
811        /// </i>
812        /// 's
813        /// <code>
814        /// descriptors
815        /// </code>
816        /// property.
817        #[optional]
818        #[unsafe(method(peripheral:didDiscoverDescriptorsForCharacteristic:error:))]
819        #[unsafe(method_family = none)]
820        unsafe fn peripheral_didDiscoverDescriptorsForCharacteristic_error(
821            &self,
822            peripheral: &CBPeripheral,
823            characteristic: &CBCharacteristic,
824            error: Option<&NSError>,
825        );
826
827        #[cfg(all(feature = "CBAttribute", feature = "CBDescriptor", feature = "CBPeer"))]
828        /// Parameter `peripheral`: The peripheral providing this information.
829        ///
830        /// Parameter `descriptor`: A
831        /// <code>
832        /// CBDescriptor
833        /// </code>
834        /// object.
835        ///
836        /// Parameter `error`: If an error occurred, the cause of the failure.
837        ///
838        ///
839        /// This method returns the result of a
840        ///
841        /// ```text
842        ///  readValueForDescriptor:
843        /// ```
844        ///
845        /// call.
846        #[optional]
847        #[unsafe(method(peripheral:didUpdateValueForDescriptor:error:))]
848        #[unsafe(method_family = none)]
849        unsafe fn peripheral_didUpdateValueForDescriptor_error(
850            &self,
851            peripheral: &CBPeripheral,
852            descriptor: &CBDescriptor,
853            error: Option<&NSError>,
854        );
855
856        #[cfg(all(feature = "CBAttribute", feature = "CBDescriptor", feature = "CBPeer"))]
857        /// Parameter `peripheral`: The peripheral providing this information.
858        ///
859        /// Parameter `descriptor`: A
860        /// <code>
861        /// CBDescriptor
862        /// </code>
863        /// object.
864        ///
865        /// Parameter `error`: If an error occurred, the cause of the failure.
866        ///
867        ///
868        /// This method returns the result of a
869        ///
870        /// ```text
871        ///  writeValue:forDescriptor:
872        /// ```
873        ///
874        /// call.
875        #[optional]
876        #[unsafe(method(peripheral:didWriteValueForDescriptor:error:))]
877        #[unsafe(method_family = none)]
878        unsafe fn peripheral_didWriteValueForDescriptor_error(
879            &self,
880            peripheral: &CBPeripheral,
881            descriptor: &CBDescriptor,
882            error: Option<&NSError>,
883        );
884
885        #[cfg(feature = "CBPeer")]
886        /// Parameter `peripheral`: The peripheral providing this update.
887        ///
888        ///
889        /// This method is invoked after a failed call to
890        ///
891        /// ```text
892        ///  writeValue:forCharacteristic:type:
893        /// ```
894        ///
895        /// , when
896        /// <i>
897        /// peripheral
898        /// </i>
899        /// is again
900        /// ready to send characteristic value updates.
901        #[optional]
902        #[unsafe(method(peripheralIsReadyToSendWriteWithoutResponse:))]
903        #[unsafe(method_family = none)]
904        unsafe fn peripheralIsReadyToSendWriteWithoutResponse(&self, peripheral: &CBPeripheral);
905
906        #[cfg(all(feature = "CBL2CAPChannel", feature = "CBPeer"))]
907        /// Parameter `peripheral`: The peripheral providing this information.
908        ///
909        /// Parameter `channel`: A
910        /// <code>
911        /// CBL2CAPChannel
912        /// </code>
913        /// object.
914        ///
915        /// Parameter `error`: If an error occurred, the cause of the failure.
916        ///
917        ///
918        /// This method returns the result of a
919        ///
920        /// ```text
921        ///  openL2CAPChannel: @link call.
922        ///  
923        ///
924        /// ```
925        #[optional]
926        #[unsafe(method(peripheral:didOpenL2CAPChannel:error:))]
927        #[unsafe(method_family = none)]
928        unsafe fn peripheral_didOpenL2CAPChannel_error(
929            &self,
930            peripheral: &CBPeripheral,
931            channel: Option<&CBL2CAPChannel>,
932            error: Option<&NSError>,
933        );
934    }
935);