fidl_cf_sc_internal_hfpprofileconfig/
fidl_cf_sc_internal_hfpprofileconfig.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10use futures::future::{self, MaybeDone, TryFutureExt};
11use zx_status;
12
13#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
14pub struct Config {
15    pub attach_phone_number_to_voice_tag: bool,
16    pub controller_encoding_cvsd: bool,
17    pub controller_encoding_msbc: bool,
18    pub echo_canceling_and_noise_reduction: bool,
19    pub enhanced_call_controls: bool,
20    pub enhanced_voice_recognition: bool,
21    pub enhanced_voice_recognition_with_text: bool,
22    pub in_band_ringtone: bool,
23    pub offload_type: String,
24    pub reject_incoming_voice_call: bool,
25    pub three_way_calling: bool,
26    pub voice_recognition: bool,
27    pub wide_band_speech: bool,
28}
29
30impl fidl::Persistable for Config {}
31
32mod internal {
33    use super::*;
34
35    impl fidl::encoding::ValueTypeMarker for Config {
36        type Borrowed<'a> = &'a Self;
37        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
38            value
39        }
40    }
41
42    unsafe impl fidl::encoding::TypeMarker for Config {
43        type Owned = Self;
44
45        #[inline(always)]
46        fn inline_align(_context: fidl::encoding::Context) -> usize {
47            8
48        }
49
50        #[inline(always)]
51        fn inline_size(_context: fidl::encoding::Context) -> usize {
52            32
53        }
54    }
55
56    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Config, D> for &Config {
57        #[inline]
58        unsafe fn encode(
59            self,
60            encoder: &mut fidl::encoding::Encoder<'_, D>,
61            offset: usize,
62            _depth: fidl::encoding::Depth,
63        ) -> fidl::Result<()> {
64            encoder.debug_check_bounds::<Config>(offset);
65            // Delegate to tuple encoding.
66            fidl::encoding::Encode::<Config, D>::encode(
67                (
68                    <bool as fidl::encoding::ValueTypeMarker>::borrow(
69                        &self.attach_phone_number_to_voice_tag,
70                    ),
71                    <bool as fidl::encoding::ValueTypeMarker>::borrow(
72                        &self.controller_encoding_cvsd,
73                    ),
74                    <bool as fidl::encoding::ValueTypeMarker>::borrow(
75                        &self.controller_encoding_msbc,
76                    ),
77                    <bool as fidl::encoding::ValueTypeMarker>::borrow(
78                        &self.echo_canceling_and_noise_reduction,
79                    ),
80                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.enhanced_call_controls),
81                    <bool as fidl::encoding::ValueTypeMarker>::borrow(
82                        &self.enhanced_voice_recognition,
83                    ),
84                    <bool as fidl::encoding::ValueTypeMarker>::borrow(
85                        &self.enhanced_voice_recognition_with_text,
86                    ),
87                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.in_band_ringtone),
88                    <fidl::encoding::BoundedString<8> as fidl::encoding::ValueTypeMarker>::borrow(
89                        &self.offload_type,
90                    ),
91                    <bool as fidl::encoding::ValueTypeMarker>::borrow(
92                        &self.reject_incoming_voice_call,
93                    ),
94                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.three_way_calling),
95                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.voice_recognition),
96                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.wide_band_speech),
97                ),
98                encoder,
99                offset,
100                _depth,
101            )
102        }
103    }
104    unsafe impl<
105            D: fidl::encoding::ResourceDialect,
106            T0: fidl::encoding::Encode<bool, D>,
107            T1: fidl::encoding::Encode<bool, D>,
108            T2: fidl::encoding::Encode<bool, D>,
109            T3: fidl::encoding::Encode<bool, D>,
110            T4: fidl::encoding::Encode<bool, D>,
111            T5: fidl::encoding::Encode<bool, D>,
112            T6: fidl::encoding::Encode<bool, D>,
113            T7: fidl::encoding::Encode<bool, D>,
114            T8: fidl::encoding::Encode<fidl::encoding::BoundedString<8>, D>,
115            T9: fidl::encoding::Encode<bool, D>,
116            T10: fidl::encoding::Encode<bool, D>,
117            T11: fidl::encoding::Encode<bool, D>,
118            T12: fidl::encoding::Encode<bool, D>,
119        > fidl::encoding::Encode<Config, D>
120        for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12)
121    {
122        #[inline]
123        unsafe fn encode(
124            self,
125            encoder: &mut fidl::encoding::Encoder<'_, D>,
126            offset: usize,
127            depth: fidl::encoding::Depth,
128        ) -> fidl::Result<()> {
129            encoder.debug_check_bounds::<Config>(offset);
130            // Zero out padding regions. There's no need to apply masks
131            // because the unmasked parts will be overwritten by fields.
132            unsafe {
133                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
134                (ptr as *mut u64).write_unaligned(0);
135            }
136            // Write the fields.
137            self.0.encode(encoder, offset + 0, depth)?;
138            self.1.encode(encoder, offset + 1, depth)?;
139            self.2.encode(encoder, offset + 2, depth)?;
140            self.3.encode(encoder, offset + 3, depth)?;
141            self.4.encode(encoder, offset + 4, depth)?;
142            self.5.encode(encoder, offset + 5, depth)?;
143            self.6.encode(encoder, offset + 6, depth)?;
144            self.7.encode(encoder, offset + 7, depth)?;
145            self.8.encode(encoder, offset + 8, depth)?;
146            self.9.encode(encoder, offset + 24, depth)?;
147            self.10.encode(encoder, offset + 25, depth)?;
148            self.11.encode(encoder, offset + 26, depth)?;
149            self.12.encode(encoder, offset + 27, depth)?;
150            Ok(())
151        }
152    }
153
154    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Config {
155        #[inline(always)]
156        fn new_empty() -> Self {
157            Self {
158                attach_phone_number_to_voice_tag: fidl::new_empty!(bool, D),
159                controller_encoding_cvsd: fidl::new_empty!(bool, D),
160                controller_encoding_msbc: fidl::new_empty!(bool, D),
161                echo_canceling_and_noise_reduction: fidl::new_empty!(bool, D),
162                enhanced_call_controls: fidl::new_empty!(bool, D),
163                enhanced_voice_recognition: fidl::new_empty!(bool, D),
164                enhanced_voice_recognition_with_text: fidl::new_empty!(bool, D),
165                in_band_ringtone: fidl::new_empty!(bool, D),
166                offload_type: fidl::new_empty!(fidl::encoding::BoundedString<8>, D),
167                reject_incoming_voice_call: fidl::new_empty!(bool, D),
168                three_way_calling: fidl::new_empty!(bool, D),
169                voice_recognition: fidl::new_empty!(bool, D),
170                wide_band_speech: fidl::new_empty!(bool, D),
171            }
172        }
173
174        #[inline]
175        unsafe fn decode(
176            &mut self,
177            decoder: &mut fidl::encoding::Decoder<'_, D>,
178            offset: usize,
179            _depth: fidl::encoding::Depth,
180        ) -> fidl::Result<()> {
181            decoder.debug_check_bounds::<Self>(offset);
182            // Verify that padding bytes are zero.
183            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
184            let padval = unsafe { (ptr as *const u64).read_unaligned() };
185            let mask = 0xffffffff00000000u64;
186            let maskedval = padval & mask;
187            if maskedval != 0 {
188                return Err(fidl::Error::NonZeroPadding {
189                    padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
190                });
191            }
192            fidl::decode!(
193                bool,
194                D,
195                &mut self.attach_phone_number_to_voice_tag,
196                decoder,
197                offset + 0,
198                _depth
199            )?;
200            fidl::decode!(
201                bool,
202                D,
203                &mut self.controller_encoding_cvsd,
204                decoder,
205                offset + 1,
206                _depth
207            )?;
208            fidl::decode!(
209                bool,
210                D,
211                &mut self.controller_encoding_msbc,
212                decoder,
213                offset + 2,
214                _depth
215            )?;
216            fidl::decode!(
217                bool,
218                D,
219                &mut self.echo_canceling_and_noise_reduction,
220                decoder,
221                offset + 3,
222                _depth
223            )?;
224            fidl::decode!(bool, D, &mut self.enhanced_call_controls, decoder, offset + 4, _depth)?;
225            fidl::decode!(
226                bool,
227                D,
228                &mut self.enhanced_voice_recognition,
229                decoder,
230                offset + 5,
231                _depth
232            )?;
233            fidl::decode!(
234                bool,
235                D,
236                &mut self.enhanced_voice_recognition_with_text,
237                decoder,
238                offset + 6,
239                _depth
240            )?;
241            fidl::decode!(bool, D, &mut self.in_band_ringtone, decoder, offset + 7, _depth)?;
242            fidl::decode!(
243                fidl::encoding::BoundedString<8>,
244                D,
245                &mut self.offload_type,
246                decoder,
247                offset + 8,
248                _depth
249            )?;
250            fidl::decode!(
251                bool,
252                D,
253                &mut self.reject_incoming_voice_call,
254                decoder,
255                offset + 24,
256                _depth
257            )?;
258            fidl::decode!(bool, D, &mut self.three_way_calling, decoder, offset + 25, _depth)?;
259            fidl::decode!(bool, D, &mut self.voice_recognition, decoder, offset + 26, _depth)?;
260            fidl::decode!(bool, D, &mut self.wide_band_speech, decoder, offset + 27, _depth)?;
261            Ok(())
262        }
263    }
264}