objc2_core_bluetooth/generated/
CBService.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11 #[unsafe(super(CBAttribute, NSObject))]
15 #[derive(Debug, PartialEq, Eq, Hash)]
16 #[cfg(feature = "CBAttribute")]
17 pub struct CBService;
18);
19
20#[cfg(feature = "CBAttribute")]
21unsafe impl NSObjectProtocol for CBService {}
22
23#[cfg(feature = "CBAttribute")]
24impl CBService {
25 extern_methods!(
26 #[cfg(all(feature = "CBPeer", feature = "CBPeripheral"))]
27 #[unsafe(method(peripheral))]
29 #[unsafe(method_family = none)]
30 pub unsafe fn peripheral(&self) -> Option<Retained<CBPeripheral>>;
31
32 #[unsafe(method(isPrimary))]
34 #[unsafe(method_family = none)]
35 pub unsafe fn isPrimary(&self) -> bool;
36
37 #[unsafe(method(includedServices))]
39 #[unsafe(method_family = none)]
40 pub unsafe fn includedServices(&self) -> Option<Retained<NSArray<CBService>>>;
41
42 #[cfg(feature = "CBCharacteristic")]
43 #[unsafe(method(characteristics))]
45 #[unsafe(method_family = none)]
46 pub unsafe fn characteristics(&self) -> Option<Retained<NSArray<CBCharacteristic>>>;
47 );
48}
49
50#[cfg(feature = "CBAttribute")]
52impl CBService {
53 extern_methods!(
54 #[unsafe(method(init))]
55 #[unsafe(method_family = init)]
56 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
57 );
58}
59
60#[cfg(feature = "CBAttribute")]
62impl CBService {
63 extern_methods!(
64 #[unsafe(method(new))]
65 #[unsafe(method_family = new)]
66 pub unsafe fn new() -> Retained<Self>;
67 );
68}
69
70extern_class!(
71 #[unsafe(super(CBService, CBAttribute, NSObject))]
86 #[derive(Debug, PartialEq, Eq, Hash)]
87 #[cfg(feature = "CBAttribute")]
88 pub struct CBMutableService;
89);
90
91#[cfg(feature = "CBAttribute")]
92unsafe impl NSObjectProtocol for CBMutableService {}
93
94#[cfg(feature = "CBAttribute")]
95impl CBMutableService {
96 extern_methods!(
97 #[unsafe(method(includedServices))]
98 #[unsafe(method_family = none)]
99 pub unsafe fn includedServices(&self) -> Option<Retained<NSArray<CBService>>>;
100
101 #[unsafe(method(setIncludedServices:))]
103 #[unsafe(method_family = none)]
104 pub unsafe fn setIncludedServices(&self, included_services: Option<&NSArray<CBService>>);
105
106 #[cfg(feature = "CBCharacteristic")]
107 #[unsafe(method(characteristics))]
108 #[unsafe(method_family = none)]
109 pub unsafe fn characteristics(&self) -> Option<Retained<NSArray<CBCharacteristic>>>;
110
111 #[cfg(feature = "CBCharacteristic")]
112 #[unsafe(method(setCharacteristics:))]
114 #[unsafe(method_family = none)]
115 pub unsafe fn setCharacteristics(
116 &self,
117 characteristics: Option<&NSArray<CBCharacteristic>>,
118 );
119
120 #[cfg(feature = "CBUUID")]
121 #[unsafe(method(initWithType:primary:))]
128 #[unsafe(method_family = init)]
129 pub unsafe fn initWithType_primary(
130 this: Allocated<Self>,
131 uuid: &CBUUID,
132 is_primary: bool,
133 ) -> Retained<Self>;
134 );
135}
136
137#[cfg(feature = "CBAttribute")]
139impl CBMutableService {
140 extern_methods!(
141 #[unsafe(method(init))]
142 #[unsafe(method_family = init)]
143 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
144 );
145}
146
147#[cfg(feature = "CBAttribute")]
149impl CBMutableService {
150 extern_methods!(
151 #[unsafe(method(new))]
152 #[unsafe(method_family = new)]
153 pub unsafe fn new() -> Retained<Self>;
154 );
155}