objc2_core_bluetooth/generated/
CBDescriptor.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5
6use crate::*;
7
8extern_class!(
9    /// Represents a characteristic's descriptor.
10    ///
11    /// See also [Apple's documentation](https://developer.apple.com/documentation/corebluetooth/cbdescriptor?language=objc)
12    #[unsafe(super(CBAttribute, NSObject))]
13    #[derive(Debug, PartialEq, Eq, Hash)]
14    #[cfg(feature = "CBAttribute")]
15    pub struct CBDescriptor;
16);
17
18#[cfg(feature = "CBAttribute")]
19unsafe impl NSObjectProtocol for CBDescriptor {}
20
21#[cfg(feature = "CBAttribute")]
22impl CBDescriptor {
23    extern_methods!(
24        #[cfg(feature = "CBCharacteristic")]
25        /// A back-pointer to the characteristic this descriptor belongs to.
26        #[unsafe(method(characteristic))]
27        #[unsafe(method_family = none)]
28        pub unsafe fn characteristic(&self) -> Option<Retained<CBCharacteristic>>;
29
30        /// The value of the descriptor. The corresponding value types for the various descriptors are detailed in
31        ///
32        /// ```text
33        ///  CBUUID.h
34        /// ```
35        ///
36        /// .
37        #[unsafe(method(value))]
38        #[unsafe(method_family = none)]
39        pub unsafe fn value(&self) -> Option<Retained<AnyObject>>;
40    );
41}
42
43/// Methods declared on superclass `CBAttribute`.
44#[cfg(feature = "CBAttribute")]
45impl CBDescriptor {
46    extern_methods!(
47        #[unsafe(method(init))]
48        #[unsafe(method_family = init)]
49        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
50    );
51}
52
53/// Methods declared on superclass `NSObject`.
54#[cfg(feature = "CBAttribute")]
55impl CBDescriptor {
56    extern_methods!(
57        #[unsafe(method(new))]
58        #[unsafe(method_family = new)]
59        pub unsafe fn new() -> Retained<Self>;
60    );
61}
62
63extern_class!(
64    /// Used to create a local characteristic descriptor, which can be added to the local database via
65    /// <code>
66    /// CBPeripheralManager
67    /// </code>
68    /// .
69    /// Once a descriptor is published, it is cached and can no longer be changed.
70    /// Descriptor types are detailed in
71    ///
72    /// ```text
73    ///  CBUUID.h
74    /// ```
75    ///
76    /// , but only the
77    /// <code>
78    /// Characteristic User Description
79    /// </code>
80    /// and
81    /// <code>
82    /// Characteristic Presentation
83    /// Format
84    /// </code>
85    /// descriptors are currently supported. The
86    /// <code>
87    /// Characteristic Extended Properties
88    /// </code>
89    /// and
90    /// <code>
91    /// Client Characteristic
92    /// Configuration
93    /// </code>
94    /// descriptors will be created automatically upon publication of the parent service, depending on the properties of the characteristic itself.
95    ///
96    /// See also [Apple's documentation](https://developer.apple.com/documentation/corebluetooth/cbmutabledescriptor?language=objc)
97    #[unsafe(super(CBDescriptor, CBAttribute, NSObject))]
98    #[derive(Debug, PartialEq, Eq, Hash)]
99    #[cfg(feature = "CBAttribute")]
100    pub struct CBMutableDescriptor;
101);
102
103#[cfg(feature = "CBAttribute")]
104unsafe impl NSObjectProtocol for CBMutableDescriptor {}
105
106#[cfg(feature = "CBAttribute")]
107impl CBMutableDescriptor {
108    extern_methods!(
109        #[cfg(feature = "CBUUID")]
110        /// Parameter `UUID`: The Bluetooth UUID of the descriptor.
111        ///
112        /// Parameter `value`: The value of the descriptor.
113        ///
114        ///
115        /// Returns a decriptor, initialized with a service type and value. The
116        /// <i>
117        /// value
118        /// </i>
119        /// is required and cannot be updated dynamically
120        /// once the parent service has been published.
121        #[unsafe(method(initWithType:value:))]
122        #[unsafe(method_family = init)]
123        pub unsafe fn initWithType_value(
124            this: Allocated<Self>,
125            uuid: &CBUUID,
126            value: Option<&AnyObject>,
127        ) -> Retained<Self>;
128    );
129}
130
131/// Methods declared on superclass `CBAttribute`.
132#[cfg(feature = "CBAttribute")]
133impl CBMutableDescriptor {
134    extern_methods!(
135        #[unsafe(method(init))]
136        #[unsafe(method_family = init)]
137        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
138    );
139}
140
141/// Methods declared on superclass `NSObject`.
142#[cfg(feature = "CBAttribute")]
143impl CBMutableDescriptor {
144    extern_methods!(
145        #[unsafe(method(new))]
146        #[unsafe(method_family = new)]
147        pub unsafe fn new() -> Retained<Self>;
148    );
149}