1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11pub const MAX_ASSOC_BASIC_RATES: u8 = 14;
12
13#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
14#[repr(C)]
15pub struct ChannelSwitchInfo {
16 pub new_channel: u8,
17}
18
19impl fidl::Persistable for ChannelSwitchInfo {}
20
21#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
22#[repr(C)]
23pub struct SignalReportIndication {
24 pub rssi_dbm: i8,
25 pub snr_db: i8,
26}
27
28impl fidl::Persistable for SignalReportIndication {}
29
30#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
32pub struct WmmAcParams {
33 pub ecw_min: u8,
37 pub ecw_max: u8,
41 pub aifsn: u8,
43 pub txop_limit: u16,
45 pub acm: bool,
47}
48
49impl fidl::Persistable for WmmAcParams {}
50
51#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
52pub struct WmmStatusResponse {
53 pub apsd: bool,
54 pub ac_be_params: WmmAcParams,
55 pub ac_bk_params: WmmAcParams,
56 pub ac_vi_params: WmmAcParams,
57 pub ac_vo_params: WmmAcParams,
58}
59
60impl fidl::Persistable for WmmStatusResponse {}
61
62mod internal {
63 use super::*;
64
65 impl fidl::encoding::ValueTypeMarker for ChannelSwitchInfo {
66 type Borrowed<'a> = &'a Self;
67 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
68 value
69 }
70 }
71
72 unsafe impl fidl::encoding::TypeMarker for ChannelSwitchInfo {
73 type Owned = Self;
74
75 #[inline(always)]
76 fn inline_align(_context: fidl::encoding::Context) -> usize {
77 1
78 }
79
80 #[inline(always)]
81 fn inline_size(_context: fidl::encoding::Context) -> usize {
82 1
83 }
84 #[inline(always)]
85 fn encode_is_copy() -> bool {
86 true
87 }
88
89 #[inline(always)]
90 fn decode_is_copy() -> bool {
91 true
92 }
93 }
94
95 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ChannelSwitchInfo, D>
96 for &ChannelSwitchInfo
97 {
98 #[inline]
99 unsafe fn encode(
100 self,
101 encoder: &mut fidl::encoding::Encoder<'_, D>,
102 offset: usize,
103 _depth: fidl::encoding::Depth,
104 ) -> fidl::Result<()> {
105 encoder.debug_check_bounds::<ChannelSwitchInfo>(offset);
106 unsafe {
107 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
109 (buf_ptr as *mut ChannelSwitchInfo)
110 .write_unaligned((self as *const ChannelSwitchInfo).read());
111 }
114 Ok(())
115 }
116 }
117 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u8, D>>
118 fidl::encoding::Encode<ChannelSwitchInfo, D> for (T0,)
119 {
120 #[inline]
121 unsafe fn encode(
122 self,
123 encoder: &mut fidl::encoding::Encoder<'_, D>,
124 offset: usize,
125 depth: fidl::encoding::Depth,
126 ) -> fidl::Result<()> {
127 encoder.debug_check_bounds::<ChannelSwitchInfo>(offset);
128 self.0.encode(encoder, offset + 0, depth)?;
132 Ok(())
133 }
134 }
135
136 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ChannelSwitchInfo {
137 #[inline(always)]
138 fn new_empty() -> Self {
139 Self { new_channel: fidl::new_empty!(u8, D) }
140 }
141
142 #[inline]
143 unsafe fn decode(
144 &mut self,
145 decoder: &mut fidl::encoding::Decoder<'_, D>,
146 offset: usize,
147 _depth: fidl::encoding::Depth,
148 ) -> fidl::Result<()> {
149 decoder.debug_check_bounds::<Self>(offset);
150 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
151 unsafe {
154 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 1);
155 }
156 Ok(())
157 }
158 }
159
160 impl fidl::encoding::ValueTypeMarker for SignalReportIndication {
161 type Borrowed<'a> = &'a Self;
162 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
163 value
164 }
165 }
166
167 unsafe impl fidl::encoding::TypeMarker for SignalReportIndication {
168 type Owned = Self;
169
170 #[inline(always)]
171 fn inline_align(_context: fidl::encoding::Context) -> usize {
172 1
173 }
174
175 #[inline(always)]
176 fn inline_size(_context: fidl::encoding::Context) -> usize {
177 2
178 }
179 #[inline(always)]
180 fn encode_is_copy() -> bool {
181 true
182 }
183
184 #[inline(always)]
185 fn decode_is_copy() -> bool {
186 true
187 }
188 }
189
190 unsafe impl<D: fidl::encoding::ResourceDialect>
191 fidl::encoding::Encode<SignalReportIndication, D> for &SignalReportIndication
192 {
193 #[inline]
194 unsafe fn encode(
195 self,
196 encoder: &mut fidl::encoding::Encoder<'_, D>,
197 offset: usize,
198 _depth: fidl::encoding::Depth,
199 ) -> fidl::Result<()> {
200 encoder.debug_check_bounds::<SignalReportIndication>(offset);
201 unsafe {
202 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
204 (buf_ptr as *mut SignalReportIndication)
205 .write_unaligned((self as *const SignalReportIndication).read());
206 }
209 Ok(())
210 }
211 }
212 unsafe impl<
213 D: fidl::encoding::ResourceDialect,
214 T0: fidl::encoding::Encode<i8, D>,
215 T1: fidl::encoding::Encode<i8, D>,
216 > fidl::encoding::Encode<SignalReportIndication, D> for (T0, T1)
217 {
218 #[inline]
219 unsafe fn encode(
220 self,
221 encoder: &mut fidl::encoding::Encoder<'_, D>,
222 offset: usize,
223 depth: fidl::encoding::Depth,
224 ) -> fidl::Result<()> {
225 encoder.debug_check_bounds::<SignalReportIndication>(offset);
226 self.0.encode(encoder, offset + 0, depth)?;
230 self.1.encode(encoder, offset + 1, depth)?;
231 Ok(())
232 }
233 }
234
235 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
236 for SignalReportIndication
237 {
238 #[inline(always)]
239 fn new_empty() -> Self {
240 Self { rssi_dbm: fidl::new_empty!(i8, D), snr_db: fidl::new_empty!(i8, D) }
241 }
242
243 #[inline]
244 unsafe fn decode(
245 &mut self,
246 decoder: &mut fidl::encoding::Decoder<'_, D>,
247 offset: usize,
248 _depth: fidl::encoding::Depth,
249 ) -> fidl::Result<()> {
250 decoder.debug_check_bounds::<Self>(offset);
251 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
252 unsafe {
255 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 2);
256 }
257 Ok(())
258 }
259 }
260
261 impl fidl::encoding::ValueTypeMarker for WmmAcParams {
262 type Borrowed<'a> = &'a Self;
263 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
264 value
265 }
266 }
267
268 unsafe impl fidl::encoding::TypeMarker for WmmAcParams {
269 type Owned = Self;
270
271 #[inline(always)]
272 fn inline_align(_context: fidl::encoding::Context) -> usize {
273 2
274 }
275
276 #[inline(always)]
277 fn inline_size(_context: fidl::encoding::Context) -> usize {
278 8
279 }
280 }
281
282 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<WmmAcParams, D>
283 for &WmmAcParams
284 {
285 #[inline]
286 unsafe fn encode(
287 self,
288 encoder: &mut fidl::encoding::Encoder<'_, D>,
289 offset: usize,
290 _depth: fidl::encoding::Depth,
291 ) -> fidl::Result<()> {
292 encoder.debug_check_bounds::<WmmAcParams>(offset);
293 fidl::encoding::Encode::<WmmAcParams, D>::encode(
295 (
296 <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.ecw_min),
297 <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.ecw_max),
298 <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.aifsn),
299 <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.txop_limit),
300 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.acm),
301 ),
302 encoder,
303 offset,
304 _depth,
305 )
306 }
307 }
308 unsafe impl<
309 D: fidl::encoding::ResourceDialect,
310 T0: fidl::encoding::Encode<u8, D>,
311 T1: fidl::encoding::Encode<u8, D>,
312 T2: fidl::encoding::Encode<u8, D>,
313 T3: fidl::encoding::Encode<u16, D>,
314 T4: fidl::encoding::Encode<bool, D>,
315 > fidl::encoding::Encode<WmmAcParams, D> for (T0, T1, T2, T3, T4)
316 {
317 #[inline]
318 unsafe fn encode(
319 self,
320 encoder: &mut fidl::encoding::Encoder<'_, D>,
321 offset: usize,
322 depth: fidl::encoding::Depth,
323 ) -> fidl::Result<()> {
324 encoder.debug_check_bounds::<WmmAcParams>(offset);
325 unsafe {
328 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(2);
329 (ptr as *mut u16).write_unaligned(0);
330 }
331 unsafe {
332 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(6);
333 (ptr as *mut u16).write_unaligned(0);
334 }
335 self.0.encode(encoder, offset + 0, depth)?;
337 self.1.encode(encoder, offset + 1, depth)?;
338 self.2.encode(encoder, offset + 2, depth)?;
339 self.3.encode(encoder, offset + 4, depth)?;
340 self.4.encode(encoder, offset + 6, depth)?;
341 Ok(())
342 }
343 }
344
345 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WmmAcParams {
346 #[inline(always)]
347 fn new_empty() -> Self {
348 Self {
349 ecw_min: fidl::new_empty!(u8, D),
350 ecw_max: fidl::new_empty!(u8, D),
351 aifsn: fidl::new_empty!(u8, D),
352 txop_limit: fidl::new_empty!(u16, D),
353 acm: fidl::new_empty!(bool, D),
354 }
355 }
356
357 #[inline]
358 unsafe fn decode(
359 &mut self,
360 decoder: &mut fidl::encoding::Decoder<'_, D>,
361 offset: usize,
362 _depth: fidl::encoding::Depth,
363 ) -> fidl::Result<()> {
364 decoder.debug_check_bounds::<Self>(offset);
365 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(2) };
367 let padval = unsafe { (ptr as *const u16).read_unaligned() };
368 let mask = 0xff00u16;
369 let maskedval = padval & mask;
370 if maskedval != 0 {
371 return Err(fidl::Error::NonZeroPadding {
372 padding_start: offset + 2 + ((mask as u64).trailing_zeros() / 8) as usize,
373 });
374 }
375 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(6) };
376 let padval = unsafe { (ptr as *const u16).read_unaligned() };
377 let mask = 0xff00u16;
378 let maskedval = padval & mask;
379 if maskedval != 0 {
380 return Err(fidl::Error::NonZeroPadding {
381 padding_start: offset + 6 + ((mask as u64).trailing_zeros() / 8) as usize,
382 });
383 }
384 fidl::decode!(u8, D, &mut self.ecw_min, decoder, offset + 0, _depth)?;
385 fidl::decode!(u8, D, &mut self.ecw_max, decoder, offset + 1, _depth)?;
386 fidl::decode!(u8, D, &mut self.aifsn, decoder, offset + 2, _depth)?;
387 fidl::decode!(u16, D, &mut self.txop_limit, decoder, offset + 4, _depth)?;
388 fidl::decode!(bool, D, &mut self.acm, decoder, offset + 6, _depth)?;
389 Ok(())
390 }
391 }
392
393 impl fidl::encoding::ValueTypeMarker for WmmStatusResponse {
394 type Borrowed<'a> = &'a Self;
395 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
396 value
397 }
398 }
399
400 unsafe impl fidl::encoding::TypeMarker for WmmStatusResponse {
401 type Owned = Self;
402
403 #[inline(always)]
404 fn inline_align(_context: fidl::encoding::Context) -> usize {
405 2
406 }
407
408 #[inline(always)]
409 fn inline_size(_context: fidl::encoding::Context) -> usize {
410 34
411 }
412 }
413
414 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<WmmStatusResponse, D>
415 for &WmmStatusResponse
416 {
417 #[inline]
418 unsafe fn encode(
419 self,
420 encoder: &mut fidl::encoding::Encoder<'_, D>,
421 offset: usize,
422 _depth: fidl::encoding::Depth,
423 ) -> fidl::Result<()> {
424 encoder.debug_check_bounds::<WmmStatusResponse>(offset);
425 fidl::encoding::Encode::<WmmStatusResponse, D>::encode(
427 (
428 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.apsd),
429 <WmmAcParams as fidl::encoding::ValueTypeMarker>::borrow(&self.ac_be_params),
430 <WmmAcParams as fidl::encoding::ValueTypeMarker>::borrow(&self.ac_bk_params),
431 <WmmAcParams as fidl::encoding::ValueTypeMarker>::borrow(&self.ac_vi_params),
432 <WmmAcParams as fidl::encoding::ValueTypeMarker>::borrow(&self.ac_vo_params),
433 ),
434 encoder,
435 offset,
436 _depth,
437 )
438 }
439 }
440 unsafe impl<
441 D: fidl::encoding::ResourceDialect,
442 T0: fidl::encoding::Encode<bool, D>,
443 T1: fidl::encoding::Encode<WmmAcParams, D>,
444 T2: fidl::encoding::Encode<WmmAcParams, D>,
445 T3: fidl::encoding::Encode<WmmAcParams, D>,
446 T4: fidl::encoding::Encode<WmmAcParams, D>,
447 > fidl::encoding::Encode<WmmStatusResponse, D> for (T0, T1, T2, T3, T4)
448 {
449 #[inline]
450 unsafe fn encode(
451 self,
452 encoder: &mut fidl::encoding::Encoder<'_, D>,
453 offset: usize,
454 depth: fidl::encoding::Depth,
455 ) -> fidl::Result<()> {
456 encoder.debug_check_bounds::<WmmStatusResponse>(offset);
457 unsafe {
460 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
461 (ptr as *mut u16).write_unaligned(0);
462 }
463 self.0.encode(encoder, offset + 0, depth)?;
465 self.1.encode(encoder, offset + 2, depth)?;
466 self.2.encode(encoder, offset + 10, depth)?;
467 self.3.encode(encoder, offset + 18, depth)?;
468 self.4.encode(encoder, offset + 26, depth)?;
469 Ok(())
470 }
471 }
472
473 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WmmStatusResponse {
474 #[inline(always)]
475 fn new_empty() -> Self {
476 Self {
477 apsd: fidl::new_empty!(bool, D),
478 ac_be_params: fidl::new_empty!(WmmAcParams, D),
479 ac_bk_params: fidl::new_empty!(WmmAcParams, D),
480 ac_vi_params: fidl::new_empty!(WmmAcParams, D),
481 ac_vo_params: fidl::new_empty!(WmmAcParams, D),
482 }
483 }
484
485 #[inline]
486 unsafe fn decode(
487 &mut self,
488 decoder: &mut fidl::encoding::Decoder<'_, D>,
489 offset: usize,
490 _depth: fidl::encoding::Depth,
491 ) -> fidl::Result<()> {
492 decoder.debug_check_bounds::<Self>(offset);
493 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
495 let padval = unsafe { (ptr as *const u16).read_unaligned() };
496 let mask = 0xff00u16;
497 let maskedval = padval & mask;
498 if maskedval != 0 {
499 return Err(fidl::Error::NonZeroPadding {
500 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
501 });
502 }
503 fidl::decode!(bool, D, &mut self.apsd, decoder, offset + 0, _depth)?;
504 fidl::decode!(WmmAcParams, D, &mut self.ac_be_params, decoder, offset + 2, _depth)?;
505 fidl::decode!(WmmAcParams, D, &mut self.ac_bk_params, decoder, offset + 10, _depth)?;
506 fidl::decode!(WmmAcParams, D, &mut self.ac_vi_params, decoder, offset + 18, _depth)?;
507 fidl::decode!(WmmAcParams, D, &mut self.ac_vo_params, decoder, offset + 26, _depth)?;
508 Ok(())
509 }
510 }
511}