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