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