Skip to main content

fidl_fuchsia_wlan_phy/
fidl_fuchsia_wlan_phy.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 _};
10pub use fidl_fuchsia_wlan_phy_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Default, PartialEq)]
15pub struct WlanPhyCreateIfaceRequest {
16    /// The station role for this interface. A device may support multiple roles,
17    /// but an interface is instantiated with a single role. This field is required.
18    pub role: Option<fidl_fuchsia_wlan_common::WlanMacRole>,
19    /// A handle to the direct MLME channel, if supported by the driver. This
20    /// channel should be used by SME to communicate with MLME via the MLME
21    /// protocol. This field is required.
22    pub mlme_channel: Option<fidl::Channel>,
23    /// The initial station address set from configuration layer.
24    ///
25    /// Excluding this field or providing a MAC address with all zeroes
26    /// will result in the driver assigning a MAC address that may
27    /// or may not be randomized.
28    pub init_sta_addr: Option<[u8; 6]>,
29    #[doc(hidden)]
30    pub __source_breaking: fidl::marker::SourceBreaking,
31}
32
33impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for WlanPhyCreateIfaceRequest {}
34
35#[derive(Debug, Default, PartialEq)]
36pub struct WlanPhyInitRequest {
37    /// Client end of a channel that notifies the WlanPhy client of events
38    /// that occur on the server, e.g., a critical error with the PHY itself.
39    ///
40    /// This field is required.
41    pub notify_client: Option<fidl::endpoints::ClientEnd<WlanPhyNotifyMarker>>,
42    #[doc(hidden)]
43    pub __source_breaking: fidl::marker::SourceBreaking,
44}
45
46impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for WlanPhyInitRequest {}
47
48#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
49pub struct WlanPhyMarker;
50
51impl fidl::endpoints::ProtocolMarker for WlanPhyMarker {
52    type Proxy = WlanPhyProxy;
53    type RequestStream = WlanPhyRequestStream;
54    #[cfg(target_os = "fuchsia")]
55    type SynchronousProxy = WlanPhySynchronousProxy;
56
57    const DEBUG_NAME: &'static str = "fuchsia.wlan.phy.WlanPhy";
58}
59impl fidl::endpoints::DiscoverableProtocolMarker for WlanPhyMarker {}
60pub type WlanPhyInitResult = Result<(), i32>;
61pub type WlanPhyGetSupportedMacRolesResult = Result<WlanPhyGetSupportedMacRolesResponse, i32>;
62pub type WlanPhyCreateIfaceResult = Result<WlanPhyCreateIfaceResponse, i32>;
63pub type WlanPhyDestroyIfaceResult = Result<(), i32>;
64pub type WlanPhySetCountryResult = Result<(), i32>;
65pub type WlanPhyClearCountryResult = Result<(), i32>;
66pub type WlanPhyGetCountryResult = Result<[u8; 2], i32>;
67pub type WlanPhySetPowerSaveModeResult = Result<(), i32>;
68pub type WlanPhyGetPowerSaveModeResult = Result<WlanPhyGetPowerSaveModeResponse, i32>;
69pub type WlanPhyPowerDownResult = Result<(), i32>;
70pub type WlanPhyPowerUpResult = Result<(), i32>;
71pub type WlanPhyResetResult = Result<(), i32>;
72pub type WlanPhyGetPowerStateResult = Result<WlanPhyGetPowerStateResponse, i32>;
73pub type WlanPhySetBtCoexistenceModeResult = Result<(), i32>;
74pub type WlanPhySetTxPowerScenarioResult = Result<(), i32>;
75pub type WlanPhyResetTxPowerScenarioResult = Result<(), i32>;
76pub type WlanPhyGetTxPowerScenarioResult = Result<fidl_fuchsia_wlan_internal::TxPowerScenario, i32>;
77
78pub trait WlanPhyProxyInterface: Send + Sync {
79    type InitResponseFut: std::future::Future<Output = Result<WlanPhyInitResult, fidl::Error>>
80        + Send;
81    fn r#init(&self, payload: WlanPhyInitRequest) -> Self::InitResponseFut;
82    type GetSupportedMacRolesResponseFut: std::future::Future<Output = Result<WlanPhyGetSupportedMacRolesResult, fidl::Error>>
83        + Send;
84    fn r#get_supported_mac_roles(&self) -> Self::GetSupportedMacRolesResponseFut;
85    type CreateIfaceResponseFut: std::future::Future<Output = Result<WlanPhyCreateIfaceResult, fidl::Error>>
86        + Send;
87    fn r#create_iface(&self, payload: WlanPhyCreateIfaceRequest) -> Self::CreateIfaceResponseFut;
88    type DestroyIfaceResponseFut: std::future::Future<Output = Result<WlanPhyDestroyIfaceResult, fidl::Error>>
89        + Send;
90    fn r#destroy_iface(
91        &self,
92        payload: &WlanPhyDestroyIfaceRequest,
93    ) -> Self::DestroyIfaceResponseFut;
94    type SetCountryResponseFut: std::future::Future<Output = Result<WlanPhySetCountryResult, fidl::Error>>
95        + Send;
96    fn r#set_country(&self, country: &[u8; 2]) -> Self::SetCountryResponseFut;
97    type ClearCountryResponseFut: std::future::Future<Output = Result<WlanPhyClearCountryResult, fidl::Error>>
98        + Send;
99    fn r#clear_country(&self) -> Self::ClearCountryResponseFut;
100    type GetCountryResponseFut: std::future::Future<Output = Result<WlanPhyGetCountryResult, fidl::Error>>
101        + Send;
102    fn r#get_country(&self) -> Self::GetCountryResponseFut;
103    type SetPowerSaveModeResponseFut: std::future::Future<Output = Result<WlanPhySetPowerSaveModeResult, fidl::Error>>
104        + Send;
105    fn r#set_power_save_mode(
106        &self,
107        payload: &WlanPhySetPowerSaveModeRequest,
108    ) -> Self::SetPowerSaveModeResponseFut;
109    type GetPowerSaveModeResponseFut: std::future::Future<Output = Result<WlanPhyGetPowerSaveModeResult, fidl::Error>>
110        + Send;
111    fn r#get_power_save_mode(&self) -> Self::GetPowerSaveModeResponseFut;
112    type PowerDownResponseFut: std::future::Future<Output = Result<WlanPhyPowerDownResult, fidl::Error>>
113        + Send;
114    fn r#power_down(&self) -> Self::PowerDownResponseFut;
115    type PowerUpResponseFut: std::future::Future<Output = Result<WlanPhyPowerUpResult, fidl::Error>>
116        + Send;
117    fn r#power_up(&self) -> Self::PowerUpResponseFut;
118    type ResetResponseFut: std::future::Future<Output = Result<WlanPhyResetResult, fidl::Error>>
119        + Send;
120    fn r#reset(&self) -> Self::ResetResponseFut;
121    type GetPowerStateResponseFut: std::future::Future<Output = Result<WlanPhyGetPowerStateResult, fidl::Error>>
122        + Send;
123    fn r#get_power_state(&self) -> Self::GetPowerStateResponseFut;
124    type SetBtCoexistenceModeResponseFut: std::future::Future<Output = Result<WlanPhySetBtCoexistenceModeResult, fidl::Error>>
125        + Send;
126    fn r#set_bt_coexistence_mode(
127        &self,
128        payload: &WlanPhySetBtCoexistenceModeRequest,
129    ) -> Self::SetBtCoexistenceModeResponseFut;
130    type SetTxPowerScenarioResponseFut: std::future::Future<Output = Result<WlanPhySetTxPowerScenarioResult, fidl::Error>>
131        + Send;
132    fn r#set_tx_power_scenario(
133        &self,
134        payload: &WlanPhySetTxPowerScenarioRequest,
135    ) -> Self::SetTxPowerScenarioResponseFut;
136    type ResetTxPowerScenarioResponseFut: std::future::Future<Output = Result<WlanPhyResetTxPowerScenarioResult, fidl::Error>>
137        + Send;
138    fn r#reset_tx_power_scenario(&self) -> Self::ResetTxPowerScenarioResponseFut;
139    type GetTxPowerScenarioResponseFut: std::future::Future<Output = Result<WlanPhyGetTxPowerScenarioResult, fidl::Error>>
140        + Send;
141    fn r#get_tx_power_scenario(&self) -> Self::GetTxPowerScenarioResponseFut;
142}
143#[derive(Debug)]
144#[cfg(target_os = "fuchsia")]
145pub struct WlanPhySynchronousProxy {
146    client: fidl::client::sync::Client,
147}
148
149#[cfg(target_os = "fuchsia")]
150impl fidl::endpoints::SynchronousProxy for WlanPhySynchronousProxy {
151    type Proxy = WlanPhyProxy;
152    type Protocol = WlanPhyMarker;
153
154    fn from_channel(inner: fidl::Channel) -> Self {
155        Self::new(inner)
156    }
157
158    fn into_channel(self) -> fidl::Channel {
159        self.client.into_channel()
160    }
161
162    fn as_channel(&self) -> &fidl::Channel {
163        self.client.as_channel()
164    }
165}
166
167#[cfg(target_os = "fuchsia")]
168impl WlanPhySynchronousProxy {
169    pub fn new(channel: fidl::Channel) -> Self {
170        Self { client: fidl::client::sync::Client::new(channel) }
171    }
172
173    pub fn into_channel(self) -> fidl::Channel {
174        self.client.into_channel()
175    }
176
177    /// Waits until an event arrives and returns it. It is safe for other
178    /// threads to make concurrent requests while waiting for an event.
179    pub fn wait_for_event(
180        &self,
181        deadline: zx::MonotonicInstant,
182    ) -> Result<WlanPhyEvent, fidl::Error> {
183        WlanPhyEvent::decode(self.client.wait_for_event::<WlanPhyMarker>(deadline)?)
184    }
185
186    /// This method can be used by the WlanPhy client to send the client end of the
187    /// WlanPhyNotify endpoint for the WlanPhy server to use. If the WlanPhy client
188    /// never invokes this method that is an indirect implication that the WlanPhyNotify is not
189    /// supported. Some possible error codes are:
190    /// ZX_ERR_NOT_SUPPORTED: The WlanPhy server does not support the WlanPhyNotify protocol.
191    pub fn r#init(
192        &self,
193        mut payload: WlanPhyInitRequest,
194        ___deadline: zx::MonotonicInstant,
195    ) -> Result<WlanPhyInitResult, fidl::Error> {
196        let _response = self.client.send_query::<
197            WlanPhyInitRequest,
198            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
199            WlanPhyMarker,
200        >(
201            &mut payload,
202            0x399fe5e97bb0eff3,
203            fidl::encoding::DynamicFlags::FLEXIBLE,
204            ___deadline,
205        )?
206        .into_result::<WlanPhyMarker>("init")?;
207        Ok(_response.map(|x| x))
208    }
209
210    /// MAC roles supported for ifaces on the physical device.
211    pub fn r#get_supported_mac_roles(
212        &self,
213        ___deadline: zx::MonotonicInstant,
214    ) -> Result<WlanPhyGetSupportedMacRolesResult, fidl::Error> {
215        let _response = self.client.send_query::<
216            fidl::encoding::EmptyPayload,
217            fidl::encoding::FlexibleResultType<WlanPhyGetSupportedMacRolesResponse, i32>,
218            WlanPhyMarker,
219        >(
220            (),
221            0x36891bcf679ad34a,
222            fidl::encoding::DynamicFlags::FLEXIBLE,
223            ___deadline,
224        )?
225        .into_result::<WlanPhyMarker>("get_supported_mac_roles")?;
226        Ok(_response.map(|x| x))
227    }
228
229    /// Create a new interface with the specified role, returning the interface id. \
230    /// Some common error codes are: \
231    /// ZX_ERR_NO_RESOURCES: maximum number of interfaces have already been created. \
232    /// ZX_ERR_NOT_SUPPORTED: device does not support the specified role.
233    pub fn r#create_iface(
234        &self,
235        mut payload: WlanPhyCreateIfaceRequest,
236        ___deadline: zx::MonotonicInstant,
237    ) -> Result<WlanPhyCreateIfaceResult, fidl::Error> {
238        let _response = self.client.send_query::<
239            WlanPhyCreateIfaceRequest,
240            fidl::encoding::FlexibleResultType<WlanPhyCreateIfaceResponse, i32>,
241            WlanPhyMarker,
242        >(
243            &mut payload,
244            0x4cc00e15727fbb8e,
245            fidl::encoding::DynamicFlags::FLEXIBLE,
246            ___deadline,
247        )?
248        .into_result::<WlanPhyMarker>("create_iface")?;
249        Ok(_response.map(|x| x))
250    }
251
252    /// Destroy the interface with the matching id. \
253    /// Some common error codes are: \
254    /// ZX_ERR_NOT_FOUND: Specified iface does not exist or has already been removed. \
255    /// ZX_ERR_SHOULD_WAIT: Device is busy and cannot be removed, try again later.
256    pub fn r#destroy_iface(
257        &self,
258        mut payload: &WlanPhyDestroyIfaceRequest,
259        ___deadline: zx::MonotonicInstant,
260    ) -> Result<WlanPhyDestroyIfaceResult, fidl::Error> {
261        let _response = self.client.send_query::<
262            WlanPhyDestroyIfaceRequest,
263            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
264            WlanPhyMarker,
265        >(
266            payload,
267            0xfa408ede62bf8bc,
268            fidl::encoding::DynamicFlags::FLEXIBLE,
269            ___deadline,
270        )?
271        .into_result::<WlanPhyMarker>("destroy_iface")?;
272        Ok(_response.map(|x| x))
273    }
274
275    /// Set country with a 2-byte country code. \
276    /// Some common error codes are: \
277    /// ZX_ERR_NOT_FOUND: Specified country code not supported. PHY state is left unchanged.
278    pub fn r#set_country(
279        &self,
280        mut country: &[u8; 2],
281        ___deadline: zx::MonotonicInstant,
282    ) -> Result<WlanPhySetCountryResult, fidl::Error> {
283        let _response = self.client.send_query::<
284            WlanPhySetCountryRequest,
285            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
286            WlanPhyMarker,
287        >(
288            (country,),
289            0x6d1258ed25af4a0f,
290            fidl::encoding::DynamicFlags::FLEXIBLE,
291            ___deadline,
292        )?
293        .into_result::<WlanPhyMarker>("set_country")?;
294        Ok(_response.map(|x| x))
295    }
296
297    /// Set device to a world-safe country, i.e. a mode that conforms to all
298    /// regulatory constraints globally. \
299    /// Generally expected to succeed if the device is in a functional state.
300    pub fn r#clear_country(
301        &self,
302        ___deadline: zx::MonotonicInstant,
303    ) -> Result<WlanPhyClearCountryResult, fidl::Error> {
304        let _response = self.client.send_query::<
305            fidl::encoding::EmptyPayload,
306            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
307            WlanPhyMarker,
308        >(
309            (),
310            0x73f333d223cec34f,
311            fidl::encoding::DynamicFlags::FLEXIBLE,
312            ___deadline,
313        )?
314        .into_result::<WlanPhyMarker>("clear_country")?;
315        Ok(_response.map(|x| x))
316    }
317
318    /// Read currently configured country. Implementations are advised to read the
319    /// country directly from the firmware, where possible. \
320    /// Generally expected to succeed if the device is in a functional state.
321    pub fn r#get_country(
322        &self,
323        ___deadline: zx::MonotonicInstant,
324    ) -> Result<WlanPhyGetCountryResult, fidl::Error> {
325        let _response = self.client.send_query::<
326            fidl::encoding::EmptyPayload,
327            fidl::encoding::FlexibleResultType<WlanPhyGetCountryResponse, i32>,
328            WlanPhyMarker,
329        >(
330            (),
331            0x13ee2c5158d8507a,
332            fidl::encoding::DynamicFlags::FLEXIBLE,
333            ___deadline,
334        )?
335        .into_result::<WlanPhyMarker>("get_country")?;
336        Ok(_response.map(|x| x.country))
337    }
338
339    /// Set Power Save mode on device. In most implementations this
340    /// likely to be set in Firmware. \
341    /// Some common error codes are: \
342    /// ZX_ERR_NOT_SUPPORTED: Specified Power Save mode not supported.
343    pub fn r#set_power_save_mode(
344        &self,
345        mut payload: &WlanPhySetPowerSaveModeRequest,
346        ___deadline: zx::MonotonicInstant,
347    ) -> Result<WlanPhySetPowerSaveModeResult, fidl::Error> {
348        let _response = self.client.send_query::<
349            WlanPhySetPowerSaveModeRequest,
350            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
351            WlanPhyMarker,
352        >(
353            payload,
354            0x4e164c65070f890d,
355            fidl::encoding::DynamicFlags::FLEXIBLE,
356            ___deadline,
357        )?
358        .into_result::<WlanPhyMarker>("set_power_save_mode")?;
359        Ok(_response.map(|x| x))
360    }
361
362    /// Get current Power Save mode from device. In most implementation this
363    /// likely to be retrieved from Firmware.
364    pub fn r#get_power_save_mode(
365        &self,
366        ___deadline: zx::MonotonicInstant,
367    ) -> Result<WlanPhyGetPowerSaveModeResult, fidl::Error> {
368        let _response = self.client.send_query::<
369            fidl::encoding::EmptyPayload,
370            fidl::encoding::FlexibleResultType<WlanPhyGetPowerSaveModeResponse, i32>,
371            WlanPhyMarker,
372        >(
373            (),
374            0x1cbd3390a4230826,
375            fidl::encoding::DynamicFlags::FLEXIBLE,
376            ___deadline,
377        )?
378        .into_result::<WlanPhyMarker>("get_power_save_mode")?;
379        Ok(_response.map(|x| x))
380    }
381
382    /// Power up/down/reset the wlan chip.
383    /// If supported, PowerDown will power down the wlan chip if it is currently powered on.
384    /// Any existing interfaces should have already been deleted before making this call or else the
385    /// driver will fail the call with error code ZX_ERR_INTERNAL.
386    /// Other possible error codes are: \
387    /// ZX_ERR_NOT_SUPPORTED: the feature is not supported by the driver.
388    /// ZX_ERR_BAD_STATE: the wlan chip is already powered down.
389    pub fn r#power_down(
390        &self,
391        ___deadline: zx::MonotonicInstant,
392    ) -> Result<WlanPhyPowerDownResult, fidl::Error> {
393        let _response = self.client.send_query::<
394            fidl::encoding::EmptyPayload,
395            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
396            WlanPhyMarker,
397        >(
398            (),
399            0x79fb1043c6355d0a,
400            fidl::encoding::DynamicFlags::FLEXIBLE,
401            ___deadline,
402        )?
403        .into_result::<WlanPhyMarker>("power_down")?;
404        Ok(_response.map(|x| x))
405    }
406
407    /// If supported, PowerUp will power up the wlan chip if it is currently powered down.
408    /// Possible error codes are: \
409    /// ZX_ERR_NOT_SUPPORTED: the feature is not supported by the driver.
410    /// ZX_ERR_BAD_STATE: the wlan chip is already powered up.
411    pub fn r#power_up(
412        &self,
413        ___deadline: zx::MonotonicInstant,
414    ) -> Result<WlanPhyPowerUpResult, fidl::Error> {
415        let _response = self.client.send_query::<
416            fidl::encoding::EmptyPayload,
417            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
418            WlanPhyMarker,
419        >(
420            (),
421            0x6dcde9a4259494f2,
422            fidl::encoding::DynamicFlags::FLEXIBLE,
423            ___deadline,
424        )?
425        .into_result::<WlanPhyMarker>("power_up")?;
426        Ok(_response.map(|x| x))
427    }
428
429    /// If supported, Reset functionality implements PowerDown then PowerUp in an attempt to
430    /// recover from an error state. For example, if an interface gets into a bad state or if
431    /// firmware crashes, the firmware/chip may be unable to perform some actions and Reset
432    /// may be able to clear the bad state.
433    /// Possible error codes are: \
434    /// ZX_ERR_NOT_SUPPORTED: the feature is not supported by the driver.
435    /// ZX_ERR_BAD_STATE: the wlan chip is already powered down.
436    pub fn r#reset(
437        &self,
438        ___deadline: zx::MonotonicInstant,
439    ) -> Result<WlanPhyResetResult, fidl::Error> {
440        let _response = self.client.send_query::<
441            fidl::encoding::EmptyPayload,
442            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
443            WlanPhyMarker,
444        >(
445            (),
446            0x2f0f1d8f2f22988f,
447            fidl::encoding::DynamicFlags::FLEXIBLE,
448            ___deadline,
449        )?
450        .into_result::<WlanPhyMarker>("reset")?;
451        Ok(_response.map(|x| x))
452    }
453
454    /// Returns the current power state of the wlan chip. After successful initialization
455    /// of the wlan driver, the state is set to true (power on) by default. power_on set to
456    /// true indicates that the wlan chip is powered on and false indicates the wlan chip
457    /// is powered off.
458    pub fn r#get_power_state(
459        &self,
460        ___deadline: zx::MonotonicInstant,
461    ) -> Result<WlanPhyGetPowerStateResult, fidl::Error> {
462        let _response = self.client.send_query::<
463            fidl::encoding::EmptyPayload,
464            fidl::encoding::FlexibleResultType<WlanPhyGetPowerStateResponse, i32>,
465            WlanPhyMarker,
466        >(
467            (),
468            0x4639d1e5e93102c1,
469            fidl::encoding::DynamicFlags::FLEXIBLE,
470            ___deadline,
471        )?
472        .into_result::<WlanPhyMarker>("get_power_state")?;
473        Ok(_response.map(|x| x))
474    }
475
476    /// Set the Bluetooth coexistence mode.
477    /// Possible error codes are: \
478    /// ZX_ERR_NOT_SUPPORTED: device does not support the specified BT coexistence mode.
479    pub fn r#set_bt_coexistence_mode(
480        &self,
481        mut payload: &WlanPhySetBtCoexistenceModeRequest,
482        ___deadline: zx::MonotonicInstant,
483    ) -> Result<WlanPhySetBtCoexistenceModeResult, fidl::Error> {
484        let _response = self.client.send_query::<
485            WlanPhySetBtCoexistenceModeRequest,
486            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
487            WlanPhyMarker,
488        >(
489            payload,
490            0x5ac69f24a87cac05,
491            fidl::encoding::DynamicFlags::FLEXIBLE,
492            ___deadline,
493        )?
494        .into_result::<WlanPhyMarker>("set_bt_coexistence_mode")?;
495        Ok(_response.map(|x| x))
496    }
497
498    pub fn r#set_tx_power_scenario(
499        &self,
500        mut payload: &WlanPhySetTxPowerScenarioRequest,
501        ___deadline: zx::MonotonicInstant,
502    ) -> Result<WlanPhySetTxPowerScenarioResult, fidl::Error> {
503        let _response = self.client.send_query::<
504            WlanPhySetTxPowerScenarioRequest,
505            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
506            WlanPhyMarker,
507        >(
508            payload,
509            0x72e4d055cd3a18dc,
510            fidl::encoding::DynamicFlags::FLEXIBLE,
511            ___deadline,
512        )?
513        .into_result::<WlanPhyMarker>("set_tx_power_scenario")?;
514        Ok(_response.map(|x| x))
515    }
516
517    pub fn r#reset_tx_power_scenario(
518        &self,
519        ___deadline: zx::MonotonicInstant,
520    ) -> Result<WlanPhyResetTxPowerScenarioResult, fidl::Error> {
521        let _response = self.client.send_query::<
522            fidl::encoding::EmptyPayload,
523            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
524            WlanPhyMarker,
525        >(
526            (),
527            0x78c3bd271b3bb712,
528            fidl::encoding::DynamicFlags::FLEXIBLE,
529            ___deadline,
530        )?
531        .into_result::<WlanPhyMarker>("reset_tx_power_scenario")?;
532        Ok(_response.map(|x| x))
533    }
534
535    pub fn r#get_tx_power_scenario(
536        &self,
537        ___deadline: zx::MonotonicInstant,
538    ) -> Result<WlanPhyGetTxPowerScenarioResult, fidl::Error> {
539        let _response = self.client.send_query::<
540            fidl::encoding::EmptyPayload,
541            fidl::encoding::FlexibleResultType<WlanPhyGetTxPowerScenarioResponse, i32>,
542            WlanPhyMarker,
543        >(
544            (),
545            0x62f9717d964b3c8e,
546            fidl::encoding::DynamicFlags::FLEXIBLE,
547            ___deadline,
548        )?
549        .into_result::<WlanPhyMarker>("get_tx_power_scenario")?;
550        Ok(_response.map(|x| x.scenario))
551    }
552}
553
554#[cfg(target_os = "fuchsia")]
555impl From<WlanPhySynchronousProxy> for zx::NullableHandle {
556    fn from(value: WlanPhySynchronousProxy) -> Self {
557        value.into_channel().into()
558    }
559}
560
561#[cfg(target_os = "fuchsia")]
562impl From<fidl::Channel> for WlanPhySynchronousProxy {
563    fn from(value: fidl::Channel) -> Self {
564        Self::new(value)
565    }
566}
567
568#[cfg(target_os = "fuchsia")]
569impl fidl::endpoints::FromClient for WlanPhySynchronousProxy {
570    type Protocol = WlanPhyMarker;
571
572    fn from_client(value: fidl::endpoints::ClientEnd<WlanPhyMarker>) -> Self {
573        Self::new(value.into_channel())
574    }
575}
576
577#[derive(Debug, Clone)]
578pub struct WlanPhyProxy {
579    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
580}
581
582impl fidl::endpoints::Proxy for WlanPhyProxy {
583    type Protocol = WlanPhyMarker;
584
585    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
586        Self::new(inner)
587    }
588
589    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
590        self.client.into_channel().map_err(|client| Self { client })
591    }
592
593    fn as_channel(&self) -> &::fidl::AsyncChannel {
594        self.client.as_channel()
595    }
596}
597
598impl WlanPhyProxy {
599    /// Create a new Proxy for fuchsia.wlan.phy/WlanPhy.
600    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
601        let protocol_name = <WlanPhyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
602        Self { client: fidl::client::Client::new(channel, protocol_name) }
603    }
604
605    /// Get a Stream of events from the remote end of the protocol.
606    ///
607    /// # Panics
608    ///
609    /// Panics if the event stream was already taken.
610    pub fn take_event_stream(&self) -> WlanPhyEventStream {
611        WlanPhyEventStream { event_receiver: self.client.take_event_receiver() }
612    }
613
614    /// This method can be used by the WlanPhy client to send the client end of the
615    /// WlanPhyNotify endpoint for the WlanPhy server to use. If the WlanPhy client
616    /// never invokes this method that is an indirect implication that the WlanPhyNotify is not
617    /// supported. Some possible error codes are:
618    /// ZX_ERR_NOT_SUPPORTED: The WlanPhy server does not support the WlanPhyNotify protocol.
619    pub fn r#init(
620        &self,
621        mut payload: WlanPhyInitRequest,
622    ) -> fidl::client::QueryResponseFut<
623        WlanPhyInitResult,
624        fidl::encoding::DefaultFuchsiaResourceDialect,
625    > {
626        WlanPhyProxyInterface::r#init(self, payload)
627    }
628
629    /// MAC roles supported for ifaces on the physical device.
630    pub fn r#get_supported_mac_roles(
631        &self,
632    ) -> fidl::client::QueryResponseFut<
633        WlanPhyGetSupportedMacRolesResult,
634        fidl::encoding::DefaultFuchsiaResourceDialect,
635    > {
636        WlanPhyProxyInterface::r#get_supported_mac_roles(self)
637    }
638
639    /// Create a new interface with the specified role, returning the interface id. \
640    /// Some common error codes are: \
641    /// ZX_ERR_NO_RESOURCES: maximum number of interfaces have already been created. \
642    /// ZX_ERR_NOT_SUPPORTED: device does not support the specified role.
643    pub fn r#create_iface(
644        &self,
645        mut payload: WlanPhyCreateIfaceRequest,
646    ) -> fidl::client::QueryResponseFut<
647        WlanPhyCreateIfaceResult,
648        fidl::encoding::DefaultFuchsiaResourceDialect,
649    > {
650        WlanPhyProxyInterface::r#create_iface(self, payload)
651    }
652
653    /// Destroy the interface with the matching id. \
654    /// Some common error codes are: \
655    /// ZX_ERR_NOT_FOUND: Specified iface does not exist or has already been removed. \
656    /// ZX_ERR_SHOULD_WAIT: Device is busy and cannot be removed, try again later.
657    pub fn r#destroy_iface(
658        &self,
659        mut payload: &WlanPhyDestroyIfaceRequest,
660    ) -> fidl::client::QueryResponseFut<
661        WlanPhyDestroyIfaceResult,
662        fidl::encoding::DefaultFuchsiaResourceDialect,
663    > {
664        WlanPhyProxyInterface::r#destroy_iface(self, payload)
665    }
666
667    /// Set country with a 2-byte country code. \
668    /// Some common error codes are: \
669    /// ZX_ERR_NOT_FOUND: Specified country code not supported. PHY state is left unchanged.
670    pub fn r#set_country(
671        &self,
672        mut country: &[u8; 2],
673    ) -> fidl::client::QueryResponseFut<
674        WlanPhySetCountryResult,
675        fidl::encoding::DefaultFuchsiaResourceDialect,
676    > {
677        WlanPhyProxyInterface::r#set_country(self, country)
678    }
679
680    /// Set device to a world-safe country, i.e. a mode that conforms to all
681    /// regulatory constraints globally. \
682    /// Generally expected to succeed if the device is in a functional state.
683    pub fn r#clear_country(
684        &self,
685    ) -> fidl::client::QueryResponseFut<
686        WlanPhyClearCountryResult,
687        fidl::encoding::DefaultFuchsiaResourceDialect,
688    > {
689        WlanPhyProxyInterface::r#clear_country(self)
690    }
691
692    /// Read currently configured country. Implementations are advised to read the
693    /// country directly from the firmware, where possible. \
694    /// Generally expected to succeed if the device is in a functional state.
695    pub fn r#get_country(
696        &self,
697    ) -> fidl::client::QueryResponseFut<
698        WlanPhyGetCountryResult,
699        fidl::encoding::DefaultFuchsiaResourceDialect,
700    > {
701        WlanPhyProxyInterface::r#get_country(self)
702    }
703
704    /// Set Power Save mode on device. In most implementations this
705    /// likely to be set in Firmware. \
706    /// Some common error codes are: \
707    /// ZX_ERR_NOT_SUPPORTED: Specified Power Save mode not supported.
708    pub fn r#set_power_save_mode(
709        &self,
710        mut payload: &WlanPhySetPowerSaveModeRequest,
711    ) -> fidl::client::QueryResponseFut<
712        WlanPhySetPowerSaveModeResult,
713        fidl::encoding::DefaultFuchsiaResourceDialect,
714    > {
715        WlanPhyProxyInterface::r#set_power_save_mode(self, payload)
716    }
717
718    /// Get current Power Save mode from device. In most implementation this
719    /// likely to be retrieved from Firmware.
720    pub fn r#get_power_save_mode(
721        &self,
722    ) -> fidl::client::QueryResponseFut<
723        WlanPhyGetPowerSaveModeResult,
724        fidl::encoding::DefaultFuchsiaResourceDialect,
725    > {
726        WlanPhyProxyInterface::r#get_power_save_mode(self)
727    }
728
729    /// Power up/down/reset the wlan chip.
730    /// If supported, PowerDown will power down the wlan chip if it is currently powered on.
731    /// Any existing interfaces should have already been deleted before making this call or else the
732    /// driver will fail the call with error code ZX_ERR_INTERNAL.
733    /// Other possible error codes are: \
734    /// ZX_ERR_NOT_SUPPORTED: the feature is not supported by the driver.
735    /// ZX_ERR_BAD_STATE: the wlan chip is already powered down.
736    pub fn r#power_down(
737        &self,
738    ) -> fidl::client::QueryResponseFut<
739        WlanPhyPowerDownResult,
740        fidl::encoding::DefaultFuchsiaResourceDialect,
741    > {
742        WlanPhyProxyInterface::r#power_down(self)
743    }
744
745    /// If supported, PowerUp will power up the wlan chip if it is currently powered down.
746    /// Possible error codes are: \
747    /// ZX_ERR_NOT_SUPPORTED: the feature is not supported by the driver.
748    /// ZX_ERR_BAD_STATE: the wlan chip is already powered up.
749    pub fn r#power_up(
750        &self,
751    ) -> fidl::client::QueryResponseFut<
752        WlanPhyPowerUpResult,
753        fidl::encoding::DefaultFuchsiaResourceDialect,
754    > {
755        WlanPhyProxyInterface::r#power_up(self)
756    }
757
758    /// If supported, Reset functionality implements PowerDown then PowerUp in an attempt to
759    /// recover from an error state. For example, if an interface gets into a bad state or if
760    /// firmware crashes, the firmware/chip may be unable to perform some actions and Reset
761    /// may be able to clear the bad state.
762    /// Possible error codes are: \
763    /// ZX_ERR_NOT_SUPPORTED: the feature is not supported by the driver.
764    /// ZX_ERR_BAD_STATE: the wlan chip is already powered down.
765    pub fn r#reset(
766        &self,
767    ) -> fidl::client::QueryResponseFut<
768        WlanPhyResetResult,
769        fidl::encoding::DefaultFuchsiaResourceDialect,
770    > {
771        WlanPhyProxyInterface::r#reset(self)
772    }
773
774    /// Returns the current power state of the wlan chip. After successful initialization
775    /// of the wlan driver, the state is set to true (power on) by default. power_on set to
776    /// true indicates that the wlan chip is powered on and false indicates the wlan chip
777    /// is powered off.
778    pub fn r#get_power_state(
779        &self,
780    ) -> fidl::client::QueryResponseFut<
781        WlanPhyGetPowerStateResult,
782        fidl::encoding::DefaultFuchsiaResourceDialect,
783    > {
784        WlanPhyProxyInterface::r#get_power_state(self)
785    }
786
787    /// Set the Bluetooth coexistence mode.
788    /// Possible error codes are: \
789    /// ZX_ERR_NOT_SUPPORTED: device does not support the specified BT coexistence mode.
790    pub fn r#set_bt_coexistence_mode(
791        &self,
792        mut payload: &WlanPhySetBtCoexistenceModeRequest,
793    ) -> fidl::client::QueryResponseFut<
794        WlanPhySetBtCoexistenceModeResult,
795        fidl::encoding::DefaultFuchsiaResourceDialect,
796    > {
797        WlanPhyProxyInterface::r#set_bt_coexistence_mode(self, payload)
798    }
799
800    pub fn r#set_tx_power_scenario(
801        &self,
802        mut payload: &WlanPhySetTxPowerScenarioRequest,
803    ) -> fidl::client::QueryResponseFut<
804        WlanPhySetTxPowerScenarioResult,
805        fidl::encoding::DefaultFuchsiaResourceDialect,
806    > {
807        WlanPhyProxyInterface::r#set_tx_power_scenario(self, payload)
808    }
809
810    pub fn r#reset_tx_power_scenario(
811        &self,
812    ) -> fidl::client::QueryResponseFut<
813        WlanPhyResetTxPowerScenarioResult,
814        fidl::encoding::DefaultFuchsiaResourceDialect,
815    > {
816        WlanPhyProxyInterface::r#reset_tx_power_scenario(self)
817    }
818
819    pub fn r#get_tx_power_scenario(
820        &self,
821    ) -> fidl::client::QueryResponseFut<
822        WlanPhyGetTxPowerScenarioResult,
823        fidl::encoding::DefaultFuchsiaResourceDialect,
824    > {
825        WlanPhyProxyInterface::r#get_tx_power_scenario(self)
826    }
827}
828
829impl WlanPhyProxyInterface for WlanPhyProxy {
830    type InitResponseFut = fidl::client::QueryResponseFut<
831        WlanPhyInitResult,
832        fidl::encoding::DefaultFuchsiaResourceDialect,
833    >;
834    fn r#init(&self, mut payload: WlanPhyInitRequest) -> Self::InitResponseFut {
835        fn _decode(
836            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
837        ) -> Result<WlanPhyInitResult, fidl::Error> {
838            let _response = fidl::client::decode_transaction_body::<
839                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
840                fidl::encoding::DefaultFuchsiaResourceDialect,
841                0x399fe5e97bb0eff3,
842            >(_buf?)?
843            .into_result::<WlanPhyMarker>("init")?;
844            Ok(_response.map(|x| x))
845        }
846        self.client.send_query_and_decode::<WlanPhyInitRequest, WlanPhyInitResult>(
847            &mut payload,
848            0x399fe5e97bb0eff3,
849            fidl::encoding::DynamicFlags::FLEXIBLE,
850            _decode,
851        )
852    }
853
854    type GetSupportedMacRolesResponseFut = fidl::client::QueryResponseFut<
855        WlanPhyGetSupportedMacRolesResult,
856        fidl::encoding::DefaultFuchsiaResourceDialect,
857    >;
858    fn r#get_supported_mac_roles(&self) -> Self::GetSupportedMacRolesResponseFut {
859        fn _decode(
860            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
861        ) -> Result<WlanPhyGetSupportedMacRolesResult, fidl::Error> {
862            let _response = fidl::client::decode_transaction_body::<
863                fidl::encoding::FlexibleResultType<WlanPhyGetSupportedMacRolesResponse, i32>,
864                fidl::encoding::DefaultFuchsiaResourceDialect,
865                0x36891bcf679ad34a,
866            >(_buf?)?
867            .into_result::<WlanPhyMarker>("get_supported_mac_roles")?;
868            Ok(_response.map(|x| x))
869        }
870        self.client.send_query_and_decode::<
871            fidl::encoding::EmptyPayload,
872            WlanPhyGetSupportedMacRolesResult,
873        >(
874            (),
875            0x36891bcf679ad34a,
876            fidl::encoding::DynamicFlags::FLEXIBLE,
877            _decode,
878        )
879    }
880
881    type CreateIfaceResponseFut = fidl::client::QueryResponseFut<
882        WlanPhyCreateIfaceResult,
883        fidl::encoding::DefaultFuchsiaResourceDialect,
884    >;
885    fn r#create_iface(
886        &self,
887        mut payload: WlanPhyCreateIfaceRequest,
888    ) -> Self::CreateIfaceResponseFut {
889        fn _decode(
890            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
891        ) -> Result<WlanPhyCreateIfaceResult, fidl::Error> {
892            let _response = fidl::client::decode_transaction_body::<
893                fidl::encoding::FlexibleResultType<WlanPhyCreateIfaceResponse, i32>,
894                fidl::encoding::DefaultFuchsiaResourceDialect,
895                0x4cc00e15727fbb8e,
896            >(_buf?)?
897            .into_result::<WlanPhyMarker>("create_iface")?;
898            Ok(_response.map(|x| x))
899        }
900        self.client.send_query_and_decode::<WlanPhyCreateIfaceRequest, WlanPhyCreateIfaceResult>(
901            &mut payload,
902            0x4cc00e15727fbb8e,
903            fidl::encoding::DynamicFlags::FLEXIBLE,
904            _decode,
905        )
906    }
907
908    type DestroyIfaceResponseFut = fidl::client::QueryResponseFut<
909        WlanPhyDestroyIfaceResult,
910        fidl::encoding::DefaultFuchsiaResourceDialect,
911    >;
912    fn r#destroy_iface(
913        &self,
914        mut payload: &WlanPhyDestroyIfaceRequest,
915    ) -> Self::DestroyIfaceResponseFut {
916        fn _decode(
917            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
918        ) -> Result<WlanPhyDestroyIfaceResult, fidl::Error> {
919            let _response = fidl::client::decode_transaction_body::<
920                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
921                fidl::encoding::DefaultFuchsiaResourceDialect,
922                0xfa408ede62bf8bc,
923            >(_buf?)?
924            .into_result::<WlanPhyMarker>("destroy_iface")?;
925            Ok(_response.map(|x| x))
926        }
927        self.client.send_query_and_decode::<WlanPhyDestroyIfaceRequest, WlanPhyDestroyIfaceResult>(
928            payload,
929            0xfa408ede62bf8bc,
930            fidl::encoding::DynamicFlags::FLEXIBLE,
931            _decode,
932        )
933    }
934
935    type SetCountryResponseFut = fidl::client::QueryResponseFut<
936        WlanPhySetCountryResult,
937        fidl::encoding::DefaultFuchsiaResourceDialect,
938    >;
939    fn r#set_country(&self, mut country: &[u8; 2]) -> Self::SetCountryResponseFut {
940        fn _decode(
941            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
942        ) -> Result<WlanPhySetCountryResult, fidl::Error> {
943            let _response = fidl::client::decode_transaction_body::<
944                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
945                fidl::encoding::DefaultFuchsiaResourceDialect,
946                0x6d1258ed25af4a0f,
947            >(_buf?)?
948            .into_result::<WlanPhyMarker>("set_country")?;
949            Ok(_response.map(|x| x))
950        }
951        self.client.send_query_and_decode::<WlanPhySetCountryRequest, WlanPhySetCountryResult>(
952            (country,),
953            0x6d1258ed25af4a0f,
954            fidl::encoding::DynamicFlags::FLEXIBLE,
955            _decode,
956        )
957    }
958
959    type ClearCountryResponseFut = fidl::client::QueryResponseFut<
960        WlanPhyClearCountryResult,
961        fidl::encoding::DefaultFuchsiaResourceDialect,
962    >;
963    fn r#clear_country(&self) -> Self::ClearCountryResponseFut {
964        fn _decode(
965            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
966        ) -> Result<WlanPhyClearCountryResult, fidl::Error> {
967            let _response = fidl::client::decode_transaction_body::<
968                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
969                fidl::encoding::DefaultFuchsiaResourceDialect,
970                0x73f333d223cec34f,
971            >(_buf?)?
972            .into_result::<WlanPhyMarker>("clear_country")?;
973            Ok(_response.map(|x| x))
974        }
975        self.client
976            .send_query_and_decode::<fidl::encoding::EmptyPayload, WlanPhyClearCountryResult>(
977                (),
978                0x73f333d223cec34f,
979                fidl::encoding::DynamicFlags::FLEXIBLE,
980                _decode,
981            )
982    }
983
984    type GetCountryResponseFut = fidl::client::QueryResponseFut<
985        WlanPhyGetCountryResult,
986        fidl::encoding::DefaultFuchsiaResourceDialect,
987    >;
988    fn r#get_country(&self) -> Self::GetCountryResponseFut {
989        fn _decode(
990            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
991        ) -> Result<WlanPhyGetCountryResult, fidl::Error> {
992            let _response = fidl::client::decode_transaction_body::<
993                fidl::encoding::FlexibleResultType<WlanPhyGetCountryResponse, i32>,
994                fidl::encoding::DefaultFuchsiaResourceDialect,
995                0x13ee2c5158d8507a,
996            >(_buf?)?
997            .into_result::<WlanPhyMarker>("get_country")?;
998            Ok(_response.map(|x| x.country))
999        }
1000        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, WlanPhyGetCountryResult>(
1001            (),
1002            0x13ee2c5158d8507a,
1003            fidl::encoding::DynamicFlags::FLEXIBLE,
1004            _decode,
1005        )
1006    }
1007
1008    type SetPowerSaveModeResponseFut = fidl::client::QueryResponseFut<
1009        WlanPhySetPowerSaveModeResult,
1010        fidl::encoding::DefaultFuchsiaResourceDialect,
1011    >;
1012    fn r#set_power_save_mode(
1013        &self,
1014        mut payload: &WlanPhySetPowerSaveModeRequest,
1015    ) -> Self::SetPowerSaveModeResponseFut {
1016        fn _decode(
1017            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1018        ) -> Result<WlanPhySetPowerSaveModeResult, fidl::Error> {
1019            let _response = fidl::client::decode_transaction_body::<
1020                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
1021                fidl::encoding::DefaultFuchsiaResourceDialect,
1022                0x4e164c65070f890d,
1023            >(_buf?)?
1024            .into_result::<WlanPhyMarker>("set_power_save_mode")?;
1025            Ok(_response.map(|x| x))
1026        }
1027        self.client
1028            .send_query_and_decode::<WlanPhySetPowerSaveModeRequest, WlanPhySetPowerSaveModeResult>(
1029                payload,
1030                0x4e164c65070f890d,
1031                fidl::encoding::DynamicFlags::FLEXIBLE,
1032                _decode,
1033            )
1034    }
1035
1036    type GetPowerSaveModeResponseFut = fidl::client::QueryResponseFut<
1037        WlanPhyGetPowerSaveModeResult,
1038        fidl::encoding::DefaultFuchsiaResourceDialect,
1039    >;
1040    fn r#get_power_save_mode(&self) -> Self::GetPowerSaveModeResponseFut {
1041        fn _decode(
1042            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1043        ) -> Result<WlanPhyGetPowerSaveModeResult, fidl::Error> {
1044            let _response = fidl::client::decode_transaction_body::<
1045                fidl::encoding::FlexibleResultType<WlanPhyGetPowerSaveModeResponse, i32>,
1046                fidl::encoding::DefaultFuchsiaResourceDialect,
1047                0x1cbd3390a4230826,
1048            >(_buf?)?
1049            .into_result::<WlanPhyMarker>("get_power_save_mode")?;
1050            Ok(_response.map(|x| x))
1051        }
1052        self.client
1053            .send_query_and_decode::<fidl::encoding::EmptyPayload, WlanPhyGetPowerSaveModeResult>(
1054                (),
1055                0x1cbd3390a4230826,
1056                fidl::encoding::DynamicFlags::FLEXIBLE,
1057                _decode,
1058            )
1059    }
1060
1061    type PowerDownResponseFut = fidl::client::QueryResponseFut<
1062        WlanPhyPowerDownResult,
1063        fidl::encoding::DefaultFuchsiaResourceDialect,
1064    >;
1065    fn r#power_down(&self) -> Self::PowerDownResponseFut {
1066        fn _decode(
1067            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1068        ) -> Result<WlanPhyPowerDownResult, fidl::Error> {
1069            let _response = fidl::client::decode_transaction_body::<
1070                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
1071                fidl::encoding::DefaultFuchsiaResourceDialect,
1072                0x79fb1043c6355d0a,
1073            >(_buf?)?
1074            .into_result::<WlanPhyMarker>("power_down")?;
1075            Ok(_response.map(|x| x))
1076        }
1077        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, WlanPhyPowerDownResult>(
1078            (),
1079            0x79fb1043c6355d0a,
1080            fidl::encoding::DynamicFlags::FLEXIBLE,
1081            _decode,
1082        )
1083    }
1084
1085    type PowerUpResponseFut = fidl::client::QueryResponseFut<
1086        WlanPhyPowerUpResult,
1087        fidl::encoding::DefaultFuchsiaResourceDialect,
1088    >;
1089    fn r#power_up(&self) -> Self::PowerUpResponseFut {
1090        fn _decode(
1091            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1092        ) -> Result<WlanPhyPowerUpResult, fidl::Error> {
1093            let _response = fidl::client::decode_transaction_body::<
1094                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
1095                fidl::encoding::DefaultFuchsiaResourceDialect,
1096                0x6dcde9a4259494f2,
1097            >(_buf?)?
1098            .into_result::<WlanPhyMarker>("power_up")?;
1099            Ok(_response.map(|x| x))
1100        }
1101        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, WlanPhyPowerUpResult>(
1102            (),
1103            0x6dcde9a4259494f2,
1104            fidl::encoding::DynamicFlags::FLEXIBLE,
1105            _decode,
1106        )
1107    }
1108
1109    type ResetResponseFut = fidl::client::QueryResponseFut<
1110        WlanPhyResetResult,
1111        fidl::encoding::DefaultFuchsiaResourceDialect,
1112    >;
1113    fn r#reset(&self) -> Self::ResetResponseFut {
1114        fn _decode(
1115            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1116        ) -> Result<WlanPhyResetResult, fidl::Error> {
1117            let _response = fidl::client::decode_transaction_body::<
1118                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
1119                fidl::encoding::DefaultFuchsiaResourceDialect,
1120                0x2f0f1d8f2f22988f,
1121            >(_buf?)?
1122            .into_result::<WlanPhyMarker>("reset")?;
1123            Ok(_response.map(|x| x))
1124        }
1125        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, WlanPhyResetResult>(
1126            (),
1127            0x2f0f1d8f2f22988f,
1128            fidl::encoding::DynamicFlags::FLEXIBLE,
1129            _decode,
1130        )
1131    }
1132
1133    type GetPowerStateResponseFut = fidl::client::QueryResponseFut<
1134        WlanPhyGetPowerStateResult,
1135        fidl::encoding::DefaultFuchsiaResourceDialect,
1136    >;
1137    fn r#get_power_state(&self) -> Self::GetPowerStateResponseFut {
1138        fn _decode(
1139            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1140        ) -> Result<WlanPhyGetPowerStateResult, fidl::Error> {
1141            let _response = fidl::client::decode_transaction_body::<
1142                fidl::encoding::FlexibleResultType<WlanPhyGetPowerStateResponse, i32>,
1143                fidl::encoding::DefaultFuchsiaResourceDialect,
1144                0x4639d1e5e93102c1,
1145            >(_buf?)?
1146            .into_result::<WlanPhyMarker>("get_power_state")?;
1147            Ok(_response.map(|x| x))
1148        }
1149        self.client
1150            .send_query_and_decode::<fidl::encoding::EmptyPayload, WlanPhyGetPowerStateResult>(
1151                (),
1152                0x4639d1e5e93102c1,
1153                fidl::encoding::DynamicFlags::FLEXIBLE,
1154                _decode,
1155            )
1156    }
1157
1158    type SetBtCoexistenceModeResponseFut = fidl::client::QueryResponseFut<
1159        WlanPhySetBtCoexistenceModeResult,
1160        fidl::encoding::DefaultFuchsiaResourceDialect,
1161    >;
1162    fn r#set_bt_coexistence_mode(
1163        &self,
1164        mut payload: &WlanPhySetBtCoexistenceModeRequest,
1165    ) -> Self::SetBtCoexistenceModeResponseFut {
1166        fn _decode(
1167            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1168        ) -> Result<WlanPhySetBtCoexistenceModeResult, fidl::Error> {
1169            let _response = fidl::client::decode_transaction_body::<
1170                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
1171                fidl::encoding::DefaultFuchsiaResourceDialect,
1172                0x5ac69f24a87cac05,
1173            >(_buf?)?
1174            .into_result::<WlanPhyMarker>("set_bt_coexistence_mode")?;
1175            Ok(_response.map(|x| x))
1176        }
1177        self.client.send_query_and_decode::<
1178            WlanPhySetBtCoexistenceModeRequest,
1179            WlanPhySetBtCoexistenceModeResult,
1180        >(
1181            payload,
1182            0x5ac69f24a87cac05,
1183            fidl::encoding::DynamicFlags::FLEXIBLE,
1184            _decode,
1185        )
1186    }
1187
1188    type SetTxPowerScenarioResponseFut = fidl::client::QueryResponseFut<
1189        WlanPhySetTxPowerScenarioResult,
1190        fidl::encoding::DefaultFuchsiaResourceDialect,
1191    >;
1192    fn r#set_tx_power_scenario(
1193        &self,
1194        mut payload: &WlanPhySetTxPowerScenarioRequest,
1195    ) -> Self::SetTxPowerScenarioResponseFut {
1196        fn _decode(
1197            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1198        ) -> Result<WlanPhySetTxPowerScenarioResult, fidl::Error> {
1199            let _response = fidl::client::decode_transaction_body::<
1200                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
1201                fidl::encoding::DefaultFuchsiaResourceDialect,
1202                0x72e4d055cd3a18dc,
1203            >(_buf?)?
1204            .into_result::<WlanPhyMarker>("set_tx_power_scenario")?;
1205            Ok(_response.map(|x| x))
1206        }
1207        self.client.send_query_and_decode::<
1208            WlanPhySetTxPowerScenarioRequest,
1209            WlanPhySetTxPowerScenarioResult,
1210        >(
1211            payload,
1212            0x72e4d055cd3a18dc,
1213            fidl::encoding::DynamicFlags::FLEXIBLE,
1214            _decode,
1215        )
1216    }
1217
1218    type ResetTxPowerScenarioResponseFut = fidl::client::QueryResponseFut<
1219        WlanPhyResetTxPowerScenarioResult,
1220        fidl::encoding::DefaultFuchsiaResourceDialect,
1221    >;
1222    fn r#reset_tx_power_scenario(&self) -> Self::ResetTxPowerScenarioResponseFut {
1223        fn _decode(
1224            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1225        ) -> Result<WlanPhyResetTxPowerScenarioResult, fidl::Error> {
1226            let _response = fidl::client::decode_transaction_body::<
1227                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
1228                fidl::encoding::DefaultFuchsiaResourceDialect,
1229                0x78c3bd271b3bb712,
1230            >(_buf?)?
1231            .into_result::<WlanPhyMarker>("reset_tx_power_scenario")?;
1232            Ok(_response.map(|x| x))
1233        }
1234        self.client.send_query_and_decode::<
1235            fidl::encoding::EmptyPayload,
1236            WlanPhyResetTxPowerScenarioResult,
1237        >(
1238            (),
1239            0x78c3bd271b3bb712,
1240            fidl::encoding::DynamicFlags::FLEXIBLE,
1241            _decode,
1242        )
1243    }
1244
1245    type GetTxPowerScenarioResponseFut = fidl::client::QueryResponseFut<
1246        WlanPhyGetTxPowerScenarioResult,
1247        fidl::encoding::DefaultFuchsiaResourceDialect,
1248    >;
1249    fn r#get_tx_power_scenario(&self) -> Self::GetTxPowerScenarioResponseFut {
1250        fn _decode(
1251            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1252        ) -> Result<WlanPhyGetTxPowerScenarioResult, fidl::Error> {
1253            let _response = fidl::client::decode_transaction_body::<
1254                fidl::encoding::FlexibleResultType<WlanPhyGetTxPowerScenarioResponse, i32>,
1255                fidl::encoding::DefaultFuchsiaResourceDialect,
1256                0x62f9717d964b3c8e,
1257            >(_buf?)?
1258            .into_result::<WlanPhyMarker>("get_tx_power_scenario")?;
1259            Ok(_response.map(|x| x.scenario))
1260        }
1261        self.client
1262            .send_query_and_decode::<fidl::encoding::EmptyPayload, WlanPhyGetTxPowerScenarioResult>(
1263                (),
1264                0x62f9717d964b3c8e,
1265                fidl::encoding::DynamicFlags::FLEXIBLE,
1266                _decode,
1267            )
1268    }
1269}
1270
1271pub struct WlanPhyEventStream {
1272    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1273}
1274
1275impl std::marker::Unpin for WlanPhyEventStream {}
1276
1277impl futures::stream::FusedStream for WlanPhyEventStream {
1278    fn is_terminated(&self) -> bool {
1279        self.event_receiver.is_terminated()
1280    }
1281}
1282
1283impl futures::Stream for WlanPhyEventStream {
1284    type Item = Result<WlanPhyEvent, fidl::Error>;
1285
1286    fn poll_next(
1287        mut self: std::pin::Pin<&mut Self>,
1288        cx: &mut std::task::Context<'_>,
1289    ) -> std::task::Poll<Option<Self::Item>> {
1290        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1291            &mut self.event_receiver,
1292            cx
1293        )?) {
1294            Some(buf) => std::task::Poll::Ready(Some(WlanPhyEvent::decode(buf))),
1295            None => std::task::Poll::Ready(None),
1296        }
1297    }
1298}
1299
1300#[derive(Debug)]
1301pub enum WlanPhyEvent {
1302    #[non_exhaustive]
1303    _UnknownEvent {
1304        /// Ordinal of the event that was sent.
1305        ordinal: u64,
1306    },
1307}
1308
1309impl WlanPhyEvent {
1310    /// Decodes a message buffer as a [`WlanPhyEvent`].
1311    fn decode(
1312        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1313    ) -> Result<WlanPhyEvent, fidl::Error> {
1314        let (bytes, _handles) = buf.split_mut();
1315        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1316        debug_assert_eq!(tx_header.tx_id, 0);
1317        match tx_header.ordinal {
1318            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1319                Ok(WlanPhyEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1320            }
1321            _ => Err(fidl::Error::UnknownOrdinal {
1322                ordinal: tx_header.ordinal,
1323                protocol_name: <WlanPhyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1324            }),
1325        }
1326    }
1327}
1328
1329/// A Stream of incoming requests for fuchsia.wlan.phy/WlanPhy.
1330pub struct WlanPhyRequestStream {
1331    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1332    is_terminated: bool,
1333}
1334
1335impl std::marker::Unpin for WlanPhyRequestStream {}
1336
1337impl futures::stream::FusedStream for WlanPhyRequestStream {
1338    fn is_terminated(&self) -> bool {
1339        self.is_terminated
1340    }
1341}
1342
1343impl fidl::endpoints::RequestStream for WlanPhyRequestStream {
1344    type Protocol = WlanPhyMarker;
1345    type ControlHandle = WlanPhyControlHandle;
1346
1347    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1348        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1349    }
1350
1351    fn control_handle(&self) -> Self::ControlHandle {
1352        WlanPhyControlHandle { inner: self.inner.clone() }
1353    }
1354
1355    fn into_inner(
1356        self,
1357    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1358    {
1359        (self.inner, self.is_terminated)
1360    }
1361
1362    fn from_inner(
1363        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1364        is_terminated: bool,
1365    ) -> Self {
1366        Self { inner, is_terminated }
1367    }
1368}
1369
1370impl futures::Stream for WlanPhyRequestStream {
1371    type Item = Result<WlanPhyRequest, fidl::Error>;
1372
1373    fn poll_next(
1374        mut self: std::pin::Pin<&mut Self>,
1375        cx: &mut std::task::Context<'_>,
1376    ) -> std::task::Poll<Option<Self::Item>> {
1377        let this = &mut *self;
1378        if this.inner.check_shutdown(cx) {
1379            this.is_terminated = true;
1380            return std::task::Poll::Ready(None);
1381        }
1382        if this.is_terminated {
1383            panic!("polled WlanPhyRequestStream after completion");
1384        }
1385        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1386            |bytes, handles| {
1387                match this.inner.channel().read_etc(cx, bytes, handles) {
1388                    std::task::Poll::Ready(Ok(())) => {}
1389                    std::task::Poll::Pending => return std::task::Poll::Pending,
1390                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1391                        this.is_terminated = true;
1392                        return std::task::Poll::Ready(None);
1393                    }
1394                    std::task::Poll::Ready(Err(e)) => {
1395                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1396                            e.into(),
1397                        ))));
1398                    }
1399                }
1400
1401                // A message has been received from the channel
1402                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1403
1404                std::task::Poll::Ready(Some(match header.ordinal {
1405                    0x399fe5e97bb0eff3 => {
1406                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1407                        let mut req = fidl::new_empty!(
1408                            WlanPhyInitRequest,
1409                            fidl::encoding::DefaultFuchsiaResourceDialect
1410                        );
1411                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WlanPhyInitRequest>(&header, _body_bytes, handles, &mut req)?;
1412                        let control_handle = WlanPhyControlHandle { inner: this.inner.clone() };
1413                        Ok(WlanPhyRequest::Init {
1414                            payload: req,
1415                            responder: WlanPhyInitResponder {
1416                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1417                                tx_id: header.tx_id,
1418                            },
1419                        })
1420                    }
1421                    0x36891bcf679ad34a => {
1422                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1423                        let mut req = fidl::new_empty!(
1424                            fidl::encoding::EmptyPayload,
1425                            fidl::encoding::DefaultFuchsiaResourceDialect
1426                        );
1427                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1428                        let control_handle = WlanPhyControlHandle { inner: this.inner.clone() };
1429                        Ok(WlanPhyRequest::GetSupportedMacRoles {
1430                            responder: WlanPhyGetSupportedMacRolesResponder {
1431                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1432                                tx_id: header.tx_id,
1433                            },
1434                        })
1435                    }
1436                    0x4cc00e15727fbb8e => {
1437                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1438                        let mut req = fidl::new_empty!(
1439                            WlanPhyCreateIfaceRequest,
1440                            fidl::encoding::DefaultFuchsiaResourceDialect
1441                        );
1442                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WlanPhyCreateIfaceRequest>(&header, _body_bytes, handles, &mut req)?;
1443                        let control_handle = WlanPhyControlHandle { inner: this.inner.clone() };
1444                        Ok(WlanPhyRequest::CreateIface {
1445                            payload: req,
1446                            responder: WlanPhyCreateIfaceResponder {
1447                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1448                                tx_id: header.tx_id,
1449                            },
1450                        })
1451                    }
1452                    0xfa408ede62bf8bc => {
1453                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1454                        let mut req = fidl::new_empty!(
1455                            WlanPhyDestroyIfaceRequest,
1456                            fidl::encoding::DefaultFuchsiaResourceDialect
1457                        );
1458                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WlanPhyDestroyIfaceRequest>(&header, _body_bytes, handles, &mut req)?;
1459                        let control_handle = WlanPhyControlHandle { inner: this.inner.clone() };
1460                        Ok(WlanPhyRequest::DestroyIface {
1461                            payload: req,
1462                            responder: WlanPhyDestroyIfaceResponder {
1463                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1464                                tx_id: header.tx_id,
1465                            },
1466                        })
1467                    }
1468                    0x6d1258ed25af4a0f => {
1469                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1470                        let mut req = fidl::new_empty!(
1471                            WlanPhySetCountryRequest,
1472                            fidl::encoding::DefaultFuchsiaResourceDialect
1473                        );
1474                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WlanPhySetCountryRequest>(&header, _body_bytes, handles, &mut req)?;
1475                        let control_handle = WlanPhyControlHandle { inner: this.inner.clone() };
1476                        Ok(WlanPhyRequest::SetCountry {
1477                            country: req.country,
1478
1479                            responder: WlanPhySetCountryResponder {
1480                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1481                                tx_id: header.tx_id,
1482                            },
1483                        })
1484                    }
1485                    0x73f333d223cec34f => {
1486                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1487                        let mut req = fidl::new_empty!(
1488                            fidl::encoding::EmptyPayload,
1489                            fidl::encoding::DefaultFuchsiaResourceDialect
1490                        );
1491                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1492                        let control_handle = WlanPhyControlHandle { inner: this.inner.clone() };
1493                        Ok(WlanPhyRequest::ClearCountry {
1494                            responder: WlanPhyClearCountryResponder {
1495                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1496                                tx_id: header.tx_id,
1497                            },
1498                        })
1499                    }
1500                    0x13ee2c5158d8507a => {
1501                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1502                        let mut req = fidl::new_empty!(
1503                            fidl::encoding::EmptyPayload,
1504                            fidl::encoding::DefaultFuchsiaResourceDialect
1505                        );
1506                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1507                        let control_handle = WlanPhyControlHandle { inner: this.inner.clone() };
1508                        Ok(WlanPhyRequest::GetCountry {
1509                            responder: WlanPhyGetCountryResponder {
1510                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1511                                tx_id: header.tx_id,
1512                            },
1513                        })
1514                    }
1515                    0x4e164c65070f890d => {
1516                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1517                        let mut req = fidl::new_empty!(
1518                            WlanPhySetPowerSaveModeRequest,
1519                            fidl::encoding::DefaultFuchsiaResourceDialect
1520                        );
1521                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WlanPhySetPowerSaveModeRequest>(&header, _body_bytes, handles, &mut req)?;
1522                        let control_handle = WlanPhyControlHandle { inner: this.inner.clone() };
1523                        Ok(WlanPhyRequest::SetPowerSaveMode {
1524                            payload: req,
1525                            responder: WlanPhySetPowerSaveModeResponder {
1526                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1527                                tx_id: header.tx_id,
1528                            },
1529                        })
1530                    }
1531                    0x1cbd3390a4230826 => {
1532                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1533                        let mut req = fidl::new_empty!(
1534                            fidl::encoding::EmptyPayload,
1535                            fidl::encoding::DefaultFuchsiaResourceDialect
1536                        );
1537                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1538                        let control_handle = WlanPhyControlHandle { inner: this.inner.clone() };
1539                        Ok(WlanPhyRequest::GetPowerSaveMode {
1540                            responder: WlanPhyGetPowerSaveModeResponder {
1541                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1542                                tx_id: header.tx_id,
1543                            },
1544                        })
1545                    }
1546                    0x79fb1043c6355d0a => {
1547                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1548                        let mut req = fidl::new_empty!(
1549                            fidl::encoding::EmptyPayload,
1550                            fidl::encoding::DefaultFuchsiaResourceDialect
1551                        );
1552                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1553                        let control_handle = WlanPhyControlHandle { inner: this.inner.clone() };
1554                        Ok(WlanPhyRequest::PowerDown {
1555                            responder: WlanPhyPowerDownResponder {
1556                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1557                                tx_id: header.tx_id,
1558                            },
1559                        })
1560                    }
1561                    0x6dcde9a4259494f2 => {
1562                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1563                        let mut req = fidl::new_empty!(
1564                            fidl::encoding::EmptyPayload,
1565                            fidl::encoding::DefaultFuchsiaResourceDialect
1566                        );
1567                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1568                        let control_handle = WlanPhyControlHandle { inner: this.inner.clone() };
1569                        Ok(WlanPhyRequest::PowerUp {
1570                            responder: WlanPhyPowerUpResponder {
1571                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1572                                tx_id: header.tx_id,
1573                            },
1574                        })
1575                    }
1576                    0x2f0f1d8f2f22988f => {
1577                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1578                        let mut req = fidl::new_empty!(
1579                            fidl::encoding::EmptyPayload,
1580                            fidl::encoding::DefaultFuchsiaResourceDialect
1581                        );
1582                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1583                        let control_handle = WlanPhyControlHandle { inner: this.inner.clone() };
1584                        Ok(WlanPhyRequest::Reset {
1585                            responder: WlanPhyResetResponder {
1586                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1587                                tx_id: header.tx_id,
1588                            },
1589                        })
1590                    }
1591                    0x4639d1e5e93102c1 => {
1592                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1593                        let mut req = fidl::new_empty!(
1594                            fidl::encoding::EmptyPayload,
1595                            fidl::encoding::DefaultFuchsiaResourceDialect
1596                        );
1597                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1598                        let control_handle = WlanPhyControlHandle { inner: this.inner.clone() };
1599                        Ok(WlanPhyRequest::GetPowerState {
1600                            responder: WlanPhyGetPowerStateResponder {
1601                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1602                                tx_id: header.tx_id,
1603                            },
1604                        })
1605                    }
1606                    0x5ac69f24a87cac05 => {
1607                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1608                        let mut req = fidl::new_empty!(
1609                            WlanPhySetBtCoexistenceModeRequest,
1610                            fidl::encoding::DefaultFuchsiaResourceDialect
1611                        );
1612                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WlanPhySetBtCoexistenceModeRequest>(&header, _body_bytes, handles, &mut req)?;
1613                        let control_handle = WlanPhyControlHandle { inner: this.inner.clone() };
1614                        Ok(WlanPhyRequest::SetBtCoexistenceMode {
1615                            payload: req,
1616                            responder: WlanPhySetBtCoexistenceModeResponder {
1617                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1618                                tx_id: header.tx_id,
1619                            },
1620                        })
1621                    }
1622                    0x72e4d055cd3a18dc => {
1623                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1624                        let mut req = fidl::new_empty!(
1625                            WlanPhySetTxPowerScenarioRequest,
1626                            fidl::encoding::DefaultFuchsiaResourceDialect
1627                        );
1628                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WlanPhySetTxPowerScenarioRequest>(&header, _body_bytes, handles, &mut req)?;
1629                        let control_handle = WlanPhyControlHandle { inner: this.inner.clone() };
1630                        Ok(WlanPhyRequest::SetTxPowerScenario {
1631                            payload: req,
1632                            responder: WlanPhySetTxPowerScenarioResponder {
1633                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1634                                tx_id: header.tx_id,
1635                            },
1636                        })
1637                    }
1638                    0x78c3bd271b3bb712 => {
1639                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1640                        let mut req = fidl::new_empty!(
1641                            fidl::encoding::EmptyPayload,
1642                            fidl::encoding::DefaultFuchsiaResourceDialect
1643                        );
1644                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1645                        let control_handle = WlanPhyControlHandle { inner: this.inner.clone() };
1646                        Ok(WlanPhyRequest::ResetTxPowerScenario {
1647                            responder: WlanPhyResetTxPowerScenarioResponder {
1648                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1649                                tx_id: header.tx_id,
1650                            },
1651                        })
1652                    }
1653                    0x62f9717d964b3c8e => {
1654                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1655                        let mut req = fidl::new_empty!(
1656                            fidl::encoding::EmptyPayload,
1657                            fidl::encoding::DefaultFuchsiaResourceDialect
1658                        );
1659                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1660                        let control_handle = WlanPhyControlHandle { inner: this.inner.clone() };
1661                        Ok(WlanPhyRequest::GetTxPowerScenario {
1662                            responder: WlanPhyGetTxPowerScenarioResponder {
1663                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1664                                tx_id: header.tx_id,
1665                            },
1666                        })
1667                    }
1668                    _ if header.tx_id == 0
1669                        && header
1670                            .dynamic_flags()
1671                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1672                    {
1673                        Ok(WlanPhyRequest::_UnknownMethod {
1674                            ordinal: header.ordinal,
1675                            control_handle: WlanPhyControlHandle { inner: this.inner.clone() },
1676                            method_type: fidl::MethodType::OneWay,
1677                        })
1678                    }
1679                    _ if header
1680                        .dynamic_flags()
1681                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1682                    {
1683                        this.inner.send_framework_err(
1684                            fidl::encoding::FrameworkErr::UnknownMethod,
1685                            header.tx_id,
1686                            header.ordinal,
1687                            header.dynamic_flags(),
1688                            (bytes, handles),
1689                        )?;
1690                        Ok(WlanPhyRequest::_UnknownMethod {
1691                            ordinal: header.ordinal,
1692                            control_handle: WlanPhyControlHandle { inner: this.inner.clone() },
1693                            method_type: fidl::MethodType::TwoWay,
1694                        })
1695                    }
1696                    _ => Err(fidl::Error::UnknownOrdinal {
1697                        ordinal: header.ordinal,
1698                        protocol_name:
1699                            <WlanPhyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1700                    }),
1701                }))
1702            },
1703        )
1704    }
1705}
1706
1707#[derive(Debug)]
1708pub enum WlanPhyRequest {
1709    /// This method can be used by the WlanPhy client to send the client end of the
1710    /// WlanPhyNotify endpoint for the WlanPhy server to use. If the WlanPhy client
1711    /// never invokes this method that is an indirect implication that the WlanPhyNotify is not
1712    /// supported. Some possible error codes are:
1713    /// ZX_ERR_NOT_SUPPORTED: The WlanPhy server does not support the WlanPhyNotify protocol.
1714    Init {
1715        payload: WlanPhyInitRequest,
1716        responder: WlanPhyInitResponder,
1717    },
1718    /// MAC roles supported for ifaces on the physical device.
1719    GetSupportedMacRoles {
1720        responder: WlanPhyGetSupportedMacRolesResponder,
1721    },
1722    /// Create a new interface with the specified role, returning the interface id. \
1723    /// Some common error codes are: \
1724    /// ZX_ERR_NO_RESOURCES: maximum number of interfaces have already been created. \
1725    /// ZX_ERR_NOT_SUPPORTED: device does not support the specified role.
1726    CreateIface {
1727        payload: WlanPhyCreateIfaceRequest,
1728        responder: WlanPhyCreateIfaceResponder,
1729    },
1730    /// Destroy the interface with the matching id. \
1731    /// Some common error codes are: \
1732    /// ZX_ERR_NOT_FOUND: Specified iface does not exist or has already been removed. \
1733    /// ZX_ERR_SHOULD_WAIT: Device is busy and cannot be removed, try again later.
1734    DestroyIface {
1735        payload: WlanPhyDestroyIfaceRequest,
1736        responder: WlanPhyDestroyIfaceResponder,
1737    },
1738    /// Set country with a 2-byte country code. \
1739    /// Some common error codes are: \
1740    /// ZX_ERR_NOT_FOUND: Specified country code not supported. PHY state is left unchanged.
1741    SetCountry {
1742        country: [u8; 2],
1743        responder: WlanPhySetCountryResponder,
1744    },
1745    /// Set device to a world-safe country, i.e. a mode that conforms to all
1746    /// regulatory constraints globally. \
1747    /// Generally expected to succeed if the device is in a functional state.
1748    ClearCountry {
1749        responder: WlanPhyClearCountryResponder,
1750    },
1751    /// Read currently configured country. Implementations are advised to read the
1752    /// country directly from the firmware, where possible. \
1753    /// Generally expected to succeed if the device is in a functional state.
1754    GetCountry {
1755        responder: WlanPhyGetCountryResponder,
1756    },
1757    /// Set Power Save mode on device. In most implementations this
1758    /// likely to be set in Firmware. \
1759    /// Some common error codes are: \
1760    /// ZX_ERR_NOT_SUPPORTED: Specified Power Save mode not supported.
1761    SetPowerSaveMode {
1762        payload: WlanPhySetPowerSaveModeRequest,
1763        responder: WlanPhySetPowerSaveModeResponder,
1764    },
1765    /// Get current Power Save mode from device. In most implementation this
1766    /// likely to be retrieved from Firmware.
1767    GetPowerSaveMode {
1768        responder: WlanPhyGetPowerSaveModeResponder,
1769    },
1770    /// Power up/down/reset the wlan chip.
1771    /// If supported, PowerDown will power down the wlan chip if it is currently powered on.
1772    /// Any existing interfaces should have already been deleted before making this call or else the
1773    /// driver will fail the call with error code ZX_ERR_INTERNAL.
1774    /// Other possible error codes are: \
1775    /// ZX_ERR_NOT_SUPPORTED: the feature is not supported by the driver.
1776    /// ZX_ERR_BAD_STATE: the wlan chip is already powered down.
1777    PowerDown {
1778        responder: WlanPhyPowerDownResponder,
1779    },
1780    /// If supported, PowerUp will power up the wlan chip if it is currently powered down.
1781    /// Possible error codes are: \
1782    /// ZX_ERR_NOT_SUPPORTED: the feature is not supported by the driver.
1783    /// ZX_ERR_BAD_STATE: the wlan chip is already powered up.
1784    PowerUp {
1785        responder: WlanPhyPowerUpResponder,
1786    },
1787    /// If supported, Reset functionality implements PowerDown then PowerUp in an attempt to
1788    /// recover from an error state. For example, if an interface gets into a bad state or if
1789    /// firmware crashes, the firmware/chip may be unable to perform some actions and Reset
1790    /// may be able to clear the bad state.
1791    /// Possible error codes are: \
1792    /// ZX_ERR_NOT_SUPPORTED: the feature is not supported by the driver.
1793    /// ZX_ERR_BAD_STATE: the wlan chip is already powered down.
1794    Reset {
1795        responder: WlanPhyResetResponder,
1796    },
1797    /// Returns the current power state of the wlan chip. After successful initialization
1798    /// of the wlan driver, the state is set to true (power on) by default. power_on set to
1799    /// true indicates that the wlan chip is powered on and false indicates the wlan chip
1800    /// is powered off.
1801    GetPowerState {
1802        responder: WlanPhyGetPowerStateResponder,
1803    },
1804    /// Set the Bluetooth coexistence mode.
1805    /// Possible error codes are: \
1806    /// ZX_ERR_NOT_SUPPORTED: device does not support the specified BT coexistence mode.
1807    SetBtCoexistenceMode {
1808        payload: WlanPhySetBtCoexistenceModeRequest,
1809        responder: WlanPhySetBtCoexistenceModeResponder,
1810    },
1811    SetTxPowerScenario {
1812        payload: WlanPhySetTxPowerScenarioRequest,
1813        responder: WlanPhySetTxPowerScenarioResponder,
1814    },
1815    ResetTxPowerScenario {
1816        responder: WlanPhyResetTxPowerScenarioResponder,
1817    },
1818    GetTxPowerScenario {
1819        responder: WlanPhyGetTxPowerScenarioResponder,
1820    },
1821    /// An interaction was received which does not match any known method.
1822    #[non_exhaustive]
1823    _UnknownMethod {
1824        /// Ordinal of the method that was called.
1825        ordinal: u64,
1826        control_handle: WlanPhyControlHandle,
1827        method_type: fidl::MethodType,
1828    },
1829}
1830
1831impl WlanPhyRequest {
1832    #[allow(irrefutable_let_patterns)]
1833    pub fn into_init(self) -> Option<(WlanPhyInitRequest, WlanPhyInitResponder)> {
1834        if let WlanPhyRequest::Init { payload, responder } = self {
1835            Some((payload, responder))
1836        } else {
1837            None
1838        }
1839    }
1840
1841    #[allow(irrefutable_let_patterns)]
1842    pub fn into_get_supported_mac_roles(self) -> Option<(WlanPhyGetSupportedMacRolesResponder)> {
1843        if let WlanPhyRequest::GetSupportedMacRoles { responder } = self {
1844            Some((responder))
1845        } else {
1846            None
1847        }
1848    }
1849
1850    #[allow(irrefutable_let_patterns)]
1851    pub fn into_create_iface(
1852        self,
1853    ) -> Option<(WlanPhyCreateIfaceRequest, WlanPhyCreateIfaceResponder)> {
1854        if let WlanPhyRequest::CreateIface { payload, responder } = self {
1855            Some((payload, responder))
1856        } else {
1857            None
1858        }
1859    }
1860
1861    #[allow(irrefutable_let_patterns)]
1862    pub fn into_destroy_iface(
1863        self,
1864    ) -> Option<(WlanPhyDestroyIfaceRequest, WlanPhyDestroyIfaceResponder)> {
1865        if let WlanPhyRequest::DestroyIface { payload, responder } = self {
1866            Some((payload, responder))
1867        } else {
1868            None
1869        }
1870    }
1871
1872    #[allow(irrefutable_let_patterns)]
1873    pub fn into_set_country(self) -> Option<([u8; 2], WlanPhySetCountryResponder)> {
1874        if let WlanPhyRequest::SetCountry { country, responder } = self {
1875            Some((country, responder))
1876        } else {
1877            None
1878        }
1879    }
1880
1881    #[allow(irrefutable_let_patterns)]
1882    pub fn into_clear_country(self) -> Option<(WlanPhyClearCountryResponder)> {
1883        if let WlanPhyRequest::ClearCountry { responder } = self { Some((responder)) } else { None }
1884    }
1885
1886    #[allow(irrefutable_let_patterns)]
1887    pub fn into_get_country(self) -> Option<(WlanPhyGetCountryResponder)> {
1888        if let WlanPhyRequest::GetCountry { responder } = self { Some((responder)) } else { None }
1889    }
1890
1891    #[allow(irrefutable_let_patterns)]
1892    pub fn into_set_power_save_mode(
1893        self,
1894    ) -> Option<(WlanPhySetPowerSaveModeRequest, WlanPhySetPowerSaveModeResponder)> {
1895        if let WlanPhyRequest::SetPowerSaveMode { payload, responder } = self {
1896            Some((payload, responder))
1897        } else {
1898            None
1899        }
1900    }
1901
1902    #[allow(irrefutable_let_patterns)]
1903    pub fn into_get_power_save_mode(self) -> Option<(WlanPhyGetPowerSaveModeResponder)> {
1904        if let WlanPhyRequest::GetPowerSaveMode { responder } = self {
1905            Some((responder))
1906        } else {
1907            None
1908        }
1909    }
1910
1911    #[allow(irrefutable_let_patterns)]
1912    pub fn into_power_down(self) -> Option<(WlanPhyPowerDownResponder)> {
1913        if let WlanPhyRequest::PowerDown { responder } = self { Some((responder)) } else { None }
1914    }
1915
1916    #[allow(irrefutable_let_patterns)]
1917    pub fn into_power_up(self) -> Option<(WlanPhyPowerUpResponder)> {
1918        if let WlanPhyRequest::PowerUp { responder } = self { Some((responder)) } else { None }
1919    }
1920
1921    #[allow(irrefutable_let_patterns)]
1922    pub fn into_reset(self) -> Option<(WlanPhyResetResponder)> {
1923        if let WlanPhyRequest::Reset { responder } = self { Some((responder)) } else { None }
1924    }
1925
1926    #[allow(irrefutable_let_patterns)]
1927    pub fn into_get_power_state(self) -> Option<(WlanPhyGetPowerStateResponder)> {
1928        if let WlanPhyRequest::GetPowerState { responder } = self {
1929            Some((responder))
1930        } else {
1931            None
1932        }
1933    }
1934
1935    #[allow(irrefutable_let_patterns)]
1936    pub fn into_set_bt_coexistence_mode(
1937        self,
1938    ) -> Option<(WlanPhySetBtCoexistenceModeRequest, WlanPhySetBtCoexistenceModeResponder)> {
1939        if let WlanPhyRequest::SetBtCoexistenceMode { payload, responder } = self {
1940            Some((payload, responder))
1941        } else {
1942            None
1943        }
1944    }
1945
1946    #[allow(irrefutable_let_patterns)]
1947    pub fn into_set_tx_power_scenario(
1948        self,
1949    ) -> Option<(WlanPhySetTxPowerScenarioRequest, WlanPhySetTxPowerScenarioResponder)> {
1950        if let WlanPhyRequest::SetTxPowerScenario { payload, responder } = self {
1951            Some((payload, responder))
1952        } else {
1953            None
1954        }
1955    }
1956
1957    #[allow(irrefutable_let_patterns)]
1958    pub fn into_reset_tx_power_scenario(self) -> Option<(WlanPhyResetTxPowerScenarioResponder)> {
1959        if let WlanPhyRequest::ResetTxPowerScenario { responder } = self {
1960            Some((responder))
1961        } else {
1962            None
1963        }
1964    }
1965
1966    #[allow(irrefutable_let_patterns)]
1967    pub fn into_get_tx_power_scenario(self) -> Option<(WlanPhyGetTxPowerScenarioResponder)> {
1968        if let WlanPhyRequest::GetTxPowerScenario { responder } = self {
1969            Some((responder))
1970        } else {
1971            None
1972        }
1973    }
1974
1975    /// Name of the method defined in FIDL
1976    pub fn method_name(&self) -> &'static str {
1977        match *self {
1978            WlanPhyRequest::Init { .. } => "init",
1979            WlanPhyRequest::GetSupportedMacRoles { .. } => "get_supported_mac_roles",
1980            WlanPhyRequest::CreateIface { .. } => "create_iface",
1981            WlanPhyRequest::DestroyIface { .. } => "destroy_iface",
1982            WlanPhyRequest::SetCountry { .. } => "set_country",
1983            WlanPhyRequest::ClearCountry { .. } => "clear_country",
1984            WlanPhyRequest::GetCountry { .. } => "get_country",
1985            WlanPhyRequest::SetPowerSaveMode { .. } => "set_power_save_mode",
1986            WlanPhyRequest::GetPowerSaveMode { .. } => "get_power_save_mode",
1987            WlanPhyRequest::PowerDown { .. } => "power_down",
1988            WlanPhyRequest::PowerUp { .. } => "power_up",
1989            WlanPhyRequest::Reset { .. } => "reset",
1990            WlanPhyRequest::GetPowerState { .. } => "get_power_state",
1991            WlanPhyRequest::SetBtCoexistenceMode { .. } => "set_bt_coexistence_mode",
1992            WlanPhyRequest::SetTxPowerScenario { .. } => "set_tx_power_scenario",
1993            WlanPhyRequest::ResetTxPowerScenario { .. } => "reset_tx_power_scenario",
1994            WlanPhyRequest::GetTxPowerScenario { .. } => "get_tx_power_scenario",
1995            WlanPhyRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
1996                "unknown one-way method"
1997            }
1998            WlanPhyRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
1999                "unknown two-way method"
2000            }
2001        }
2002    }
2003}
2004
2005#[derive(Debug, Clone)]
2006pub struct WlanPhyControlHandle {
2007    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2008}
2009
2010impl fidl::endpoints::ControlHandle for WlanPhyControlHandle {
2011    fn shutdown(&self) {
2012        self.inner.shutdown()
2013    }
2014
2015    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2016        self.inner.shutdown_with_epitaph(status)
2017    }
2018
2019    fn is_closed(&self) -> bool {
2020        self.inner.channel().is_closed()
2021    }
2022    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2023        self.inner.channel().on_closed()
2024    }
2025
2026    #[cfg(target_os = "fuchsia")]
2027    fn signal_peer(
2028        &self,
2029        clear_mask: zx::Signals,
2030        set_mask: zx::Signals,
2031    ) -> Result<(), zx_status::Status> {
2032        use fidl::Peered;
2033        self.inner.channel().signal_peer(clear_mask, set_mask)
2034    }
2035}
2036
2037impl WlanPhyControlHandle {}
2038
2039#[must_use = "FIDL methods require a response to be sent"]
2040#[derive(Debug)]
2041pub struct WlanPhyInitResponder {
2042    control_handle: std::mem::ManuallyDrop<WlanPhyControlHandle>,
2043    tx_id: u32,
2044}
2045
2046/// Set the the channel to be shutdown (see [`WlanPhyControlHandle::shutdown`])
2047/// if the responder is dropped without sending a response, so that the client
2048/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2049impl std::ops::Drop for WlanPhyInitResponder {
2050    fn drop(&mut self) {
2051        self.control_handle.shutdown();
2052        // Safety: drops once, never accessed again
2053        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2054    }
2055}
2056
2057impl fidl::endpoints::Responder for WlanPhyInitResponder {
2058    type ControlHandle = WlanPhyControlHandle;
2059
2060    fn control_handle(&self) -> &WlanPhyControlHandle {
2061        &self.control_handle
2062    }
2063
2064    fn drop_without_shutdown(mut self) {
2065        // Safety: drops once, never accessed again due to mem::forget
2066        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2067        // Prevent Drop from running (which would shut down the channel)
2068        std::mem::forget(self);
2069    }
2070}
2071
2072impl WlanPhyInitResponder {
2073    /// Sends a response to the FIDL transaction.
2074    ///
2075    /// Sets the channel to shutdown if an error occurs.
2076    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2077        let _result = self.send_raw(result);
2078        if _result.is_err() {
2079            self.control_handle.shutdown();
2080        }
2081        self.drop_without_shutdown();
2082        _result
2083    }
2084
2085    /// Similar to "send" but does not shutdown the channel if an error occurs.
2086    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2087        let _result = self.send_raw(result);
2088        self.drop_without_shutdown();
2089        _result
2090    }
2091
2092    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2093        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2094            fidl::encoding::EmptyStruct,
2095            i32,
2096        >>(
2097            fidl::encoding::FlexibleResult::new(result),
2098            self.tx_id,
2099            0x399fe5e97bb0eff3,
2100            fidl::encoding::DynamicFlags::FLEXIBLE,
2101        )
2102    }
2103}
2104
2105#[must_use = "FIDL methods require a response to be sent"]
2106#[derive(Debug)]
2107pub struct WlanPhyGetSupportedMacRolesResponder {
2108    control_handle: std::mem::ManuallyDrop<WlanPhyControlHandle>,
2109    tx_id: u32,
2110}
2111
2112/// Set the the channel to be shutdown (see [`WlanPhyControlHandle::shutdown`])
2113/// if the responder is dropped without sending a response, so that the client
2114/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2115impl std::ops::Drop for WlanPhyGetSupportedMacRolesResponder {
2116    fn drop(&mut self) {
2117        self.control_handle.shutdown();
2118        // Safety: drops once, never accessed again
2119        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2120    }
2121}
2122
2123impl fidl::endpoints::Responder for WlanPhyGetSupportedMacRolesResponder {
2124    type ControlHandle = WlanPhyControlHandle;
2125
2126    fn control_handle(&self) -> &WlanPhyControlHandle {
2127        &self.control_handle
2128    }
2129
2130    fn drop_without_shutdown(mut self) {
2131        // Safety: drops once, never accessed again due to mem::forget
2132        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2133        // Prevent Drop from running (which would shut down the channel)
2134        std::mem::forget(self);
2135    }
2136}
2137
2138impl WlanPhyGetSupportedMacRolesResponder {
2139    /// Sends a response to the FIDL transaction.
2140    ///
2141    /// Sets the channel to shutdown if an error occurs.
2142    pub fn send(
2143        self,
2144        mut result: Result<&WlanPhyGetSupportedMacRolesResponse, i32>,
2145    ) -> Result<(), fidl::Error> {
2146        let _result = self.send_raw(result);
2147        if _result.is_err() {
2148            self.control_handle.shutdown();
2149        }
2150        self.drop_without_shutdown();
2151        _result
2152    }
2153
2154    /// Similar to "send" but does not shutdown the channel if an error occurs.
2155    pub fn send_no_shutdown_on_err(
2156        self,
2157        mut result: Result<&WlanPhyGetSupportedMacRolesResponse, i32>,
2158    ) -> Result<(), fidl::Error> {
2159        let _result = self.send_raw(result);
2160        self.drop_without_shutdown();
2161        _result
2162    }
2163
2164    fn send_raw(
2165        &self,
2166        mut result: Result<&WlanPhyGetSupportedMacRolesResponse, i32>,
2167    ) -> Result<(), fidl::Error> {
2168        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2169            WlanPhyGetSupportedMacRolesResponse,
2170            i32,
2171        >>(
2172            fidl::encoding::FlexibleResult::new(result),
2173            self.tx_id,
2174            0x36891bcf679ad34a,
2175            fidl::encoding::DynamicFlags::FLEXIBLE,
2176        )
2177    }
2178}
2179
2180#[must_use = "FIDL methods require a response to be sent"]
2181#[derive(Debug)]
2182pub struct WlanPhyCreateIfaceResponder {
2183    control_handle: std::mem::ManuallyDrop<WlanPhyControlHandle>,
2184    tx_id: u32,
2185}
2186
2187/// Set the the channel to be shutdown (see [`WlanPhyControlHandle::shutdown`])
2188/// if the responder is dropped without sending a response, so that the client
2189/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2190impl std::ops::Drop for WlanPhyCreateIfaceResponder {
2191    fn drop(&mut self) {
2192        self.control_handle.shutdown();
2193        // Safety: drops once, never accessed again
2194        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2195    }
2196}
2197
2198impl fidl::endpoints::Responder for WlanPhyCreateIfaceResponder {
2199    type ControlHandle = WlanPhyControlHandle;
2200
2201    fn control_handle(&self) -> &WlanPhyControlHandle {
2202        &self.control_handle
2203    }
2204
2205    fn drop_without_shutdown(mut self) {
2206        // Safety: drops once, never accessed again due to mem::forget
2207        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2208        // Prevent Drop from running (which would shut down the channel)
2209        std::mem::forget(self);
2210    }
2211}
2212
2213impl WlanPhyCreateIfaceResponder {
2214    /// Sends a response to the FIDL transaction.
2215    ///
2216    /// Sets the channel to shutdown if an error occurs.
2217    pub fn send(
2218        self,
2219        mut result: Result<&WlanPhyCreateIfaceResponse, i32>,
2220    ) -> Result<(), fidl::Error> {
2221        let _result = self.send_raw(result);
2222        if _result.is_err() {
2223            self.control_handle.shutdown();
2224        }
2225        self.drop_without_shutdown();
2226        _result
2227    }
2228
2229    /// Similar to "send" but does not shutdown the channel if an error occurs.
2230    pub fn send_no_shutdown_on_err(
2231        self,
2232        mut result: Result<&WlanPhyCreateIfaceResponse, i32>,
2233    ) -> Result<(), fidl::Error> {
2234        let _result = self.send_raw(result);
2235        self.drop_without_shutdown();
2236        _result
2237    }
2238
2239    fn send_raw(
2240        &self,
2241        mut result: Result<&WlanPhyCreateIfaceResponse, i32>,
2242    ) -> Result<(), fidl::Error> {
2243        self.control_handle
2244            .inner
2245            .send::<fidl::encoding::FlexibleResultType<WlanPhyCreateIfaceResponse, i32>>(
2246                fidl::encoding::FlexibleResult::new(result),
2247                self.tx_id,
2248                0x4cc00e15727fbb8e,
2249                fidl::encoding::DynamicFlags::FLEXIBLE,
2250            )
2251    }
2252}
2253
2254#[must_use = "FIDL methods require a response to be sent"]
2255#[derive(Debug)]
2256pub struct WlanPhyDestroyIfaceResponder {
2257    control_handle: std::mem::ManuallyDrop<WlanPhyControlHandle>,
2258    tx_id: u32,
2259}
2260
2261/// Set the the channel to be shutdown (see [`WlanPhyControlHandle::shutdown`])
2262/// if the responder is dropped without sending a response, so that the client
2263/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2264impl std::ops::Drop for WlanPhyDestroyIfaceResponder {
2265    fn drop(&mut self) {
2266        self.control_handle.shutdown();
2267        // Safety: drops once, never accessed again
2268        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2269    }
2270}
2271
2272impl fidl::endpoints::Responder for WlanPhyDestroyIfaceResponder {
2273    type ControlHandle = WlanPhyControlHandle;
2274
2275    fn control_handle(&self) -> &WlanPhyControlHandle {
2276        &self.control_handle
2277    }
2278
2279    fn drop_without_shutdown(mut self) {
2280        // Safety: drops once, never accessed again due to mem::forget
2281        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2282        // Prevent Drop from running (which would shut down the channel)
2283        std::mem::forget(self);
2284    }
2285}
2286
2287impl WlanPhyDestroyIfaceResponder {
2288    /// Sends a response to the FIDL transaction.
2289    ///
2290    /// Sets the channel to shutdown if an error occurs.
2291    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2292        let _result = self.send_raw(result);
2293        if _result.is_err() {
2294            self.control_handle.shutdown();
2295        }
2296        self.drop_without_shutdown();
2297        _result
2298    }
2299
2300    /// Similar to "send" but does not shutdown the channel if an error occurs.
2301    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2302        let _result = self.send_raw(result);
2303        self.drop_without_shutdown();
2304        _result
2305    }
2306
2307    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2308        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2309            fidl::encoding::EmptyStruct,
2310            i32,
2311        >>(
2312            fidl::encoding::FlexibleResult::new(result),
2313            self.tx_id,
2314            0xfa408ede62bf8bc,
2315            fidl::encoding::DynamicFlags::FLEXIBLE,
2316        )
2317    }
2318}
2319
2320#[must_use = "FIDL methods require a response to be sent"]
2321#[derive(Debug)]
2322pub struct WlanPhySetCountryResponder {
2323    control_handle: std::mem::ManuallyDrop<WlanPhyControlHandle>,
2324    tx_id: u32,
2325}
2326
2327/// Set the the channel to be shutdown (see [`WlanPhyControlHandle::shutdown`])
2328/// if the responder is dropped without sending a response, so that the client
2329/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2330impl std::ops::Drop for WlanPhySetCountryResponder {
2331    fn drop(&mut self) {
2332        self.control_handle.shutdown();
2333        // Safety: drops once, never accessed again
2334        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2335    }
2336}
2337
2338impl fidl::endpoints::Responder for WlanPhySetCountryResponder {
2339    type ControlHandle = WlanPhyControlHandle;
2340
2341    fn control_handle(&self) -> &WlanPhyControlHandle {
2342        &self.control_handle
2343    }
2344
2345    fn drop_without_shutdown(mut self) {
2346        // Safety: drops once, never accessed again due to mem::forget
2347        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2348        // Prevent Drop from running (which would shut down the channel)
2349        std::mem::forget(self);
2350    }
2351}
2352
2353impl WlanPhySetCountryResponder {
2354    /// Sends a response to the FIDL transaction.
2355    ///
2356    /// Sets the channel to shutdown if an error occurs.
2357    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2358        let _result = self.send_raw(result);
2359        if _result.is_err() {
2360            self.control_handle.shutdown();
2361        }
2362        self.drop_without_shutdown();
2363        _result
2364    }
2365
2366    /// Similar to "send" but does not shutdown the channel if an error occurs.
2367    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2368        let _result = self.send_raw(result);
2369        self.drop_without_shutdown();
2370        _result
2371    }
2372
2373    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2374        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2375            fidl::encoding::EmptyStruct,
2376            i32,
2377        >>(
2378            fidl::encoding::FlexibleResult::new(result),
2379            self.tx_id,
2380            0x6d1258ed25af4a0f,
2381            fidl::encoding::DynamicFlags::FLEXIBLE,
2382        )
2383    }
2384}
2385
2386#[must_use = "FIDL methods require a response to be sent"]
2387#[derive(Debug)]
2388pub struct WlanPhyClearCountryResponder {
2389    control_handle: std::mem::ManuallyDrop<WlanPhyControlHandle>,
2390    tx_id: u32,
2391}
2392
2393/// Set the the channel to be shutdown (see [`WlanPhyControlHandle::shutdown`])
2394/// if the responder is dropped without sending a response, so that the client
2395/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2396impl std::ops::Drop for WlanPhyClearCountryResponder {
2397    fn drop(&mut self) {
2398        self.control_handle.shutdown();
2399        // Safety: drops once, never accessed again
2400        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2401    }
2402}
2403
2404impl fidl::endpoints::Responder for WlanPhyClearCountryResponder {
2405    type ControlHandle = WlanPhyControlHandle;
2406
2407    fn control_handle(&self) -> &WlanPhyControlHandle {
2408        &self.control_handle
2409    }
2410
2411    fn drop_without_shutdown(mut self) {
2412        // Safety: drops once, never accessed again due to mem::forget
2413        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2414        // Prevent Drop from running (which would shut down the channel)
2415        std::mem::forget(self);
2416    }
2417}
2418
2419impl WlanPhyClearCountryResponder {
2420    /// Sends a response to the FIDL transaction.
2421    ///
2422    /// Sets the channel to shutdown if an error occurs.
2423    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2424        let _result = self.send_raw(result);
2425        if _result.is_err() {
2426            self.control_handle.shutdown();
2427        }
2428        self.drop_without_shutdown();
2429        _result
2430    }
2431
2432    /// Similar to "send" but does not shutdown the channel if an error occurs.
2433    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2434        let _result = self.send_raw(result);
2435        self.drop_without_shutdown();
2436        _result
2437    }
2438
2439    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2440        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2441            fidl::encoding::EmptyStruct,
2442            i32,
2443        >>(
2444            fidl::encoding::FlexibleResult::new(result),
2445            self.tx_id,
2446            0x73f333d223cec34f,
2447            fidl::encoding::DynamicFlags::FLEXIBLE,
2448        )
2449    }
2450}
2451
2452#[must_use = "FIDL methods require a response to be sent"]
2453#[derive(Debug)]
2454pub struct WlanPhyGetCountryResponder {
2455    control_handle: std::mem::ManuallyDrop<WlanPhyControlHandle>,
2456    tx_id: u32,
2457}
2458
2459/// Set the the channel to be shutdown (see [`WlanPhyControlHandle::shutdown`])
2460/// if the responder is dropped without sending a response, so that the client
2461/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2462impl std::ops::Drop for WlanPhyGetCountryResponder {
2463    fn drop(&mut self) {
2464        self.control_handle.shutdown();
2465        // Safety: drops once, never accessed again
2466        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2467    }
2468}
2469
2470impl fidl::endpoints::Responder for WlanPhyGetCountryResponder {
2471    type ControlHandle = WlanPhyControlHandle;
2472
2473    fn control_handle(&self) -> &WlanPhyControlHandle {
2474        &self.control_handle
2475    }
2476
2477    fn drop_without_shutdown(mut self) {
2478        // Safety: drops once, never accessed again due to mem::forget
2479        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2480        // Prevent Drop from running (which would shut down the channel)
2481        std::mem::forget(self);
2482    }
2483}
2484
2485impl WlanPhyGetCountryResponder {
2486    /// Sends a response to the FIDL transaction.
2487    ///
2488    /// Sets the channel to shutdown if an error occurs.
2489    pub fn send(self, mut result: Result<&[u8; 2], i32>) -> Result<(), fidl::Error> {
2490        let _result = self.send_raw(result);
2491        if _result.is_err() {
2492            self.control_handle.shutdown();
2493        }
2494        self.drop_without_shutdown();
2495        _result
2496    }
2497
2498    /// Similar to "send" but does not shutdown the channel if an error occurs.
2499    pub fn send_no_shutdown_on_err(
2500        self,
2501        mut result: Result<&[u8; 2], i32>,
2502    ) -> Result<(), fidl::Error> {
2503        let _result = self.send_raw(result);
2504        self.drop_without_shutdown();
2505        _result
2506    }
2507
2508    fn send_raw(&self, mut result: Result<&[u8; 2], i32>) -> Result<(), fidl::Error> {
2509        self.control_handle
2510            .inner
2511            .send::<fidl::encoding::FlexibleResultType<WlanPhyGetCountryResponse, i32>>(
2512                fidl::encoding::FlexibleResult::new(result.map(|country| (country,))),
2513                self.tx_id,
2514                0x13ee2c5158d8507a,
2515                fidl::encoding::DynamicFlags::FLEXIBLE,
2516            )
2517    }
2518}
2519
2520#[must_use = "FIDL methods require a response to be sent"]
2521#[derive(Debug)]
2522pub struct WlanPhySetPowerSaveModeResponder {
2523    control_handle: std::mem::ManuallyDrop<WlanPhyControlHandle>,
2524    tx_id: u32,
2525}
2526
2527/// Set the the channel to be shutdown (see [`WlanPhyControlHandle::shutdown`])
2528/// if the responder is dropped without sending a response, so that the client
2529/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2530impl std::ops::Drop for WlanPhySetPowerSaveModeResponder {
2531    fn drop(&mut self) {
2532        self.control_handle.shutdown();
2533        // Safety: drops once, never accessed again
2534        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2535    }
2536}
2537
2538impl fidl::endpoints::Responder for WlanPhySetPowerSaveModeResponder {
2539    type ControlHandle = WlanPhyControlHandle;
2540
2541    fn control_handle(&self) -> &WlanPhyControlHandle {
2542        &self.control_handle
2543    }
2544
2545    fn drop_without_shutdown(mut self) {
2546        // Safety: drops once, never accessed again due to mem::forget
2547        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2548        // Prevent Drop from running (which would shut down the channel)
2549        std::mem::forget(self);
2550    }
2551}
2552
2553impl WlanPhySetPowerSaveModeResponder {
2554    /// Sends a response to the FIDL transaction.
2555    ///
2556    /// Sets the channel to shutdown if an error occurs.
2557    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2558        let _result = self.send_raw(result);
2559        if _result.is_err() {
2560            self.control_handle.shutdown();
2561        }
2562        self.drop_without_shutdown();
2563        _result
2564    }
2565
2566    /// Similar to "send" but does not shutdown the channel if an error occurs.
2567    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2568        let _result = self.send_raw(result);
2569        self.drop_without_shutdown();
2570        _result
2571    }
2572
2573    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2574        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2575            fidl::encoding::EmptyStruct,
2576            i32,
2577        >>(
2578            fidl::encoding::FlexibleResult::new(result),
2579            self.tx_id,
2580            0x4e164c65070f890d,
2581            fidl::encoding::DynamicFlags::FLEXIBLE,
2582        )
2583    }
2584}
2585
2586#[must_use = "FIDL methods require a response to be sent"]
2587#[derive(Debug)]
2588pub struct WlanPhyGetPowerSaveModeResponder {
2589    control_handle: std::mem::ManuallyDrop<WlanPhyControlHandle>,
2590    tx_id: u32,
2591}
2592
2593/// Set the the channel to be shutdown (see [`WlanPhyControlHandle::shutdown`])
2594/// if the responder is dropped without sending a response, so that the client
2595/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2596impl std::ops::Drop for WlanPhyGetPowerSaveModeResponder {
2597    fn drop(&mut self) {
2598        self.control_handle.shutdown();
2599        // Safety: drops once, never accessed again
2600        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2601    }
2602}
2603
2604impl fidl::endpoints::Responder for WlanPhyGetPowerSaveModeResponder {
2605    type ControlHandle = WlanPhyControlHandle;
2606
2607    fn control_handle(&self) -> &WlanPhyControlHandle {
2608        &self.control_handle
2609    }
2610
2611    fn drop_without_shutdown(mut self) {
2612        // Safety: drops once, never accessed again due to mem::forget
2613        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2614        // Prevent Drop from running (which would shut down the channel)
2615        std::mem::forget(self);
2616    }
2617}
2618
2619impl WlanPhyGetPowerSaveModeResponder {
2620    /// Sends a response to the FIDL transaction.
2621    ///
2622    /// Sets the channel to shutdown if an error occurs.
2623    pub fn send(
2624        self,
2625        mut result: Result<&WlanPhyGetPowerSaveModeResponse, i32>,
2626    ) -> Result<(), fidl::Error> {
2627        let _result = self.send_raw(result);
2628        if _result.is_err() {
2629            self.control_handle.shutdown();
2630        }
2631        self.drop_without_shutdown();
2632        _result
2633    }
2634
2635    /// Similar to "send" but does not shutdown the channel if an error occurs.
2636    pub fn send_no_shutdown_on_err(
2637        self,
2638        mut result: Result<&WlanPhyGetPowerSaveModeResponse, i32>,
2639    ) -> Result<(), fidl::Error> {
2640        let _result = self.send_raw(result);
2641        self.drop_without_shutdown();
2642        _result
2643    }
2644
2645    fn send_raw(
2646        &self,
2647        mut result: Result<&WlanPhyGetPowerSaveModeResponse, i32>,
2648    ) -> Result<(), fidl::Error> {
2649        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2650            WlanPhyGetPowerSaveModeResponse,
2651            i32,
2652        >>(
2653            fidl::encoding::FlexibleResult::new(result),
2654            self.tx_id,
2655            0x1cbd3390a4230826,
2656            fidl::encoding::DynamicFlags::FLEXIBLE,
2657        )
2658    }
2659}
2660
2661#[must_use = "FIDL methods require a response to be sent"]
2662#[derive(Debug)]
2663pub struct WlanPhyPowerDownResponder {
2664    control_handle: std::mem::ManuallyDrop<WlanPhyControlHandle>,
2665    tx_id: u32,
2666}
2667
2668/// Set the the channel to be shutdown (see [`WlanPhyControlHandle::shutdown`])
2669/// if the responder is dropped without sending a response, so that the client
2670/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2671impl std::ops::Drop for WlanPhyPowerDownResponder {
2672    fn drop(&mut self) {
2673        self.control_handle.shutdown();
2674        // Safety: drops once, never accessed again
2675        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2676    }
2677}
2678
2679impl fidl::endpoints::Responder for WlanPhyPowerDownResponder {
2680    type ControlHandle = WlanPhyControlHandle;
2681
2682    fn control_handle(&self) -> &WlanPhyControlHandle {
2683        &self.control_handle
2684    }
2685
2686    fn drop_without_shutdown(mut self) {
2687        // Safety: drops once, never accessed again due to mem::forget
2688        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2689        // Prevent Drop from running (which would shut down the channel)
2690        std::mem::forget(self);
2691    }
2692}
2693
2694impl WlanPhyPowerDownResponder {
2695    /// Sends a response to the FIDL transaction.
2696    ///
2697    /// Sets the channel to shutdown if an error occurs.
2698    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2699        let _result = self.send_raw(result);
2700        if _result.is_err() {
2701            self.control_handle.shutdown();
2702        }
2703        self.drop_without_shutdown();
2704        _result
2705    }
2706
2707    /// Similar to "send" but does not shutdown the channel if an error occurs.
2708    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2709        let _result = self.send_raw(result);
2710        self.drop_without_shutdown();
2711        _result
2712    }
2713
2714    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2715        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2716            fidl::encoding::EmptyStruct,
2717            i32,
2718        >>(
2719            fidl::encoding::FlexibleResult::new(result),
2720            self.tx_id,
2721            0x79fb1043c6355d0a,
2722            fidl::encoding::DynamicFlags::FLEXIBLE,
2723        )
2724    }
2725}
2726
2727#[must_use = "FIDL methods require a response to be sent"]
2728#[derive(Debug)]
2729pub struct WlanPhyPowerUpResponder {
2730    control_handle: std::mem::ManuallyDrop<WlanPhyControlHandle>,
2731    tx_id: u32,
2732}
2733
2734/// Set the the channel to be shutdown (see [`WlanPhyControlHandle::shutdown`])
2735/// if the responder is dropped without sending a response, so that the client
2736/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2737impl std::ops::Drop for WlanPhyPowerUpResponder {
2738    fn drop(&mut self) {
2739        self.control_handle.shutdown();
2740        // Safety: drops once, never accessed again
2741        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2742    }
2743}
2744
2745impl fidl::endpoints::Responder for WlanPhyPowerUpResponder {
2746    type ControlHandle = WlanPhyControlHandle;
2747
2748    fn control_handle(&self) -> &WlanPhyControlHandle {
2749        &self.control_handle
2750    }
2751
2752    fn drop_without_shutdown(mut self) {
2753        // Safety: drops once, never accessed again due to mem::forget
2754        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2755        // Prevent Drop from running (which would shut down the channel)
2756        std::mem::forget(self);
2757    }
2758}
2759
2760impl WlanPhyPowerUpResponder {
2761    /// Sends a response to the FIDL transaction.
2762    ///
2763    /// Sets the channel to shutdown if an error occurs.
2764    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2765        let _result = self.send_raw(result);
2766        if _result.is_err() {
2767            self.control_handle.shutdown();
2768        }
2769        self.drop_without_shutdown();
2770        _result
2771    }
2772
2773    /// Similar to "send" but does not shutdown the channel if an error occurs.
2774    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2775        let _result = self.send_raw(result);
2776        self.drop_without_shutdown();
2777        _result
2778    }
2779
2780    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2781        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2782            fidl::encoding::EmptyStruct,
2783            i32,
2784        >>(
2785            fidl::encoding::FlexibleResult::new(result),
2786            self.tx_id,
2787            0x6dcde9a4259494f2,
2788            fidl::encoding::DynamicFlags::FLEXIBLE,
2789        )
2790    }
2791}
2792
2793#[must_use = "FIDL methods require a response to be sent"]
2794#[derive(Debug)]
2795pub struct WlanPhyResetResponder {
2796    control_handle: std::mem::ManuallyDrop<WlanPhyControlHandle>,
2797    tx_id: u32,
2798}
2799
2800/// Set the the channel to be shutdown (see [`WlanPhyControlHandle::shutdown`])
2801/// if the responder is dropped without sending a response, so that the client
2802/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2803impl std::ops::Drop for WlanPhyResetResponder {
2804    fn drop(&mut self) {
2805        self.control_handle.shutdown();
2806        // Safety: drops once, never accessed again
2807        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2808    }
2809}
2810
2811impl fidl::endpoints::Responder for WlanPhyResetResponder {
2812    type ControlHandle = WlanPhyControlHandle;
2813
2814    fn control_handle(&self) -> &WlanPhyControlHandle {
2815        &self.control_handle
2816    }
2817
2818    fn drop_without_shutdown(mut self) {
2819        // Safety: drops once, never accessed again due to mem::forget
2820        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2821        // Prevent Drop from running (which would shut down the channel)
2822        std::mem::forget(self);
2823    }
2824}
2825
2826impl WlanPhyResetResponder {
2827    /// Sends a response to the FIDL transaction.
2828    ///
2829    /// Sets the channel to shutdown if an error occurs.
2830    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2831        let _result = self.send_raw(result);
2832        if _result.is_err() {
2833            self.control_handle.shutdown();
2834        }
2835        self.drop_without_shutdown();
2836        _result
2837    }
2838
2839    /// Similar to "send" but does not shutdown the channel if an error occurs.
2840    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2841        let _result = self.send_raw(result);
2842        self.drop_without_shutdown();
2843        _result
2844    }
2845
2846    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2847        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2848            fidl::encoding::EmptyStruct,
2849            i32,
2850        >>(
2851            fidl::encoding::FlexibleResult::new(result),
2852            self.tx_id,
2853            0x2f0f1d8f2f22988f,
2854            fidl::encoding::DynamicFlags::FLEXIBLE,
2855        )
2856    }
2857}
2858
2859#[must_use = "FIDL methods require a response to be sent"]
2860#[derive(Debug)]
2861pub struct WlanPhyGetPowerStateResponder {
2862    control_handle: std::mem::ManuallyDrop<WlanPhyControlHandle>,
2863    tx_id: u32,
2864}
2865
2866/// Set the the channel to be shutdown (see [`WlanPhyControlHandle::shutdown`])
2867/// if the responder is dropped without sending a response, so that the client
2868/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2869impl std::ops::Drop for WlanPhyGetPowerStateResponder {
2870    fn drop(&mut self) {
2871        self.control_handle.shutdown();
2872        // Safety: drops once, never accessed again
2873        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2874    }
2875}
2876
2877impl fidl::endpoints::Responder for WlanPhyGetPowerStateResponder {
2878    type ControlHandle = WlanPhyControlHandle;
2879
2880    fn control_handle(&self) -> &WlanPhyControlHandle {
2881        &self.control_handle
2882    }
2883
2884    fn drop_without_shutdown(mut self) {
2885        // Safety: drops once, never accessed again due to mem::forget
2886        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2887        // Prevent Drop from running (which would shut down the channel)
2888        std::mem::forget(self);
2889    }
2890}
2891
2892impl WlanPhyGetPowerStateResponder {
2893    /// Sends a response to the FIDL transaction.
2894    ///
2895    /// Sets the channel to shutdown if an error occurs.
2896    pub fn send(
2897        self,
2898        mut result: Result<&WlanPhyGetPowerStateResponse, i32>,
2899    ) -> Result<(), fidl::Error> {
2900        let _result = self.send_raw(result);
2901        if _result.is_err() {
2902            self.control_handle.shutdown();
2903        }
2904        self.drop_without_shutdown();
2905        _result
2906    }
2907
2908    /// Similar to "send" but does not shutdown the channel if an error occurs.
2909    pub fn send_no_shutdown_on_err(
2910        self,
2911        mut result: Result<&WlanPhyGetPowerStateResponse, i32>,
2912    ) -> Result<(), fidl::Error> {
2913        let _result = self.send_raw(result);
2914        self.drop_without_shutdown();
2915        _result
2916    }
2917
2918    fn send_raw(
2919        &self,
2920        mut result: Result<&WlanPhyGetPowerStateResponse, i32>,
2921    ) -> Result<(), fidl::Error> {
2922        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2923            WlanPhyGetPowerStateResponse,
2924            i32,
2925        >>(
2926            fidl::encoding::FlexibleResult::new(result),
2927            self.tx_id,
2928            0x4639d1e5e93102c1,
2929            fidl::encoding::DynamicFlags::FLEXIBLE,
2930        )
2931    }
2932}
2933
2934#[must_use = "FIDL methods require a response to be sent"]
2935#[derive(Debug)]
2936pub struct WlanPhySetBtCoexistenceModeResponder {
2937    control_handle: std::mem::ManuallyDrop<WlanPhyControlHandle>,
2938    tx_id: u32,
2939}
2940
2941/// Set the the channel to be shutdown (see [`WlanPhyControlHandle::shutdown`])
2942/// if the responder is dropped without sending a response, so that the client
2943/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2944impl std::ops::Drop for WlanPhySetBtCoexistenceModeResponder {
2945    fn drop(&mut self) {
2946        self.control_handle.shutdown();
2947        // Safety: drops once, never accessed again
2948        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2949    }
2950}
2951
2952impl fidl::endpoints::Responder for WlanPhySetBtCoexistenceModeResponder {
2953    type ControlHandle = WlanPhyControlHandle;
2954
2955    fn control_handle(&self) -> &WlanPhyControlHandle {
2956        &self.control_handle
2957    }
2958
2959    fn drop_without_shutdown(mut self) {
2960        // Safety: drops once, never accessed again due to mem::forget
2961        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2962        // Prevent Drop from running (which would shut down the channel)
2963        std::mem::forget(self);
2964    }
2965}
2966
2967impl WlanPhySetBtCoexistenceModeResponder {
2968    /// Sends a response to the FIDL transaction.
2969    ///
2970    /// Sets the channel to shutdown if an error occurs.
2971    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2972        let _result = self.send_raw(result);
2973        if _result.is_err() {
2974            self.control_handle.shutdown();
2975        }
2976        self.drop_without_shutdown();
2977        _result
2978    }
2979
2980    /// Similar to "send" but does not shutdown the channel if an error occurs.
2981    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2982        let _result = self.send_raw(result);
2983        self.drop_without_shutdown();
2984        _result
2985    }
2986
2987    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2988        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2989            fidl::encoding::EmptyStruct,
2990            i32,
2991        >>(
2992            fidl::encoding::FlexibleResult::new(result),
2993            self.tx_id,
2994            0x5ac69f24a87cac05,
2995            fidl::encoding::DynamicFlags::FLEXIBLE,
2996        )
2997    }
2998}
2999
3000#[must_use = "FIDL methods require a response to be sent"]
3001#[derive(Debug)]
3002pub struct WlanPhySetTxPowerScenarioResponder {
3003    control_handle: std::mem::ManuallyDrop<WlanPhyControlHandle>,
3004    tx_id: u32,
3005}
3006
3007/// Set the the channel to be shutdown (see [`WlanPhyControlHandle::shutdown`])
3008/// if the responder is dropped without sending a response, so that the client
3009/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3010impl std::ops::Drop for WlanPhySetTxPowerScenarioResponder {
3011    fn drop(&mut self) {
3012        self.control_handle.shutdown();
3013        // Safety: drops once, never accessed again
3014        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3015    }
3016}
3017
3018impl fidl::endpoints::Responder for WlanPhySetTxPowerScenarioResponder {
3019    type ControlHandle = WlanPhyControlHandle;
3020
3021    fn control_handle(&self) -> &WlanPhyControlHandle {
3022        &self.control_handle
3023    }
3024
3025    fn drop_without_shutdown(mut self) {
3026        // Safety: drops once, never accessed again due to mem::forget
3027        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3028        // Prevent Drop from running (which would shut down the channel)
3029        std::mem::forget(self);
3030    }
3031}
3032
3033impl WlanPhySetTxPowerScenarioResponder {
3034    /// Sends a response to the FIDL transaction.
3035    ///
3036    /// Sets the channel to shutdown if an error occurs.
3037    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3038        let _result = self.send_raw(result);
3039        if _result.is_err() {
3040            self.control_handle.shutdown();
3041        }
3042        self.drop_without_shutdown();
3043        _result
3044    }
3045
3046    /// Similar to "send" but does not shutdown the channel if an error occurs.
3047    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3048        let _result = self.send_raw(result);
3049        self.drop_without_shutdown();
3050        _result
3051    }
3052
3053    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3054        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3055            fidl::encoding::EmptyStruct,
3056            i32,
3057        >>(
3058            fidl::encoding::FlexibleResult::new(result),
3059            self.tx_id,
3060            0x72e4d055cd3a18dc,
3061            fidl::encoding::DynamicFlags::FLEXIBLE,
3062        )
3063    }
3064}
3065
3066#[must_use = "FIDL methods require a response to be sent"]
3067#[derive(Debug)]
3068pub struct WlanPhyResetTxPowerScenarioResponder {
3069    control_handle: std::mem::ManuallyDrop<WlanPhyControlHandle>,
3070    tx_id: u32,
3071}
3072
3073/// Set the the channel to be shutdown (see [`WlanPhyControlHandle::shutdown`])
3074/// if the responder is dropped without sending a response, so that the client
3075/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3076impl std::ops::Drop for WlanPhyResetTxPowerScenarioResponder {
3077    fn drop(&mut self) {
3078        self.control_handle.shutdown();
3079        // Safety: drops once, never accessed again
3080        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3081    }
3082}
3083
3084impl fidl::endpoints::Responder for WlanPhyResetTxPowerScenarioResponder {
3085    type ControlHandle = WlanPhyControlHandle;
3086
3087    fn control_handle(&self) -> &WlanPhyControlHandle {
3088        &self.control_handle
3089    }
3090
3091    fn drop_without_shutdown(mut self) {
3092        // Safety: drops once, never accessed again due to mem::forget
3093        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3094        // Prevent Drop from running (which would shut down the channel)
3095        std::mem::forget(self);
3096    }
3097}
3098
3099impl WlanPhyResetTxPowerScenarioResponder {
3100    /// Sends a response to the FIDL transaction.
3101    ///
3102    /// Sets the channel to shutdown if an error occurs.
3103    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3104        let _result = self.send_raw(result);
3105        if _result.is_err() {
3106            self.control_handle.shutdown();
3107        }
3108        self.drop_without_shutdown();
3109        _result
3110    }
3111
3112    /// Similar to "send" but does not shutdown the channel if an error occurs.
3113    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3114        let _result = self.send_raw(result);
3115        self.drop_without_shutdown();
3116        _result
3117    }
3118
3119    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3120        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3121            fidl::encoding::EmptyStruct,
3122            i32,
3123        >>(
3124            fidl::encoding::FlexibleResult::new(result),
3125            self.tx_id,
3126            0x78c3bd271b3bb712,
3127            fidl::encoding::DynamicFlags::FLEXIBLE,
3128        )
3129    }
3130}
3131
3132#[must_use = "FIDL methods require a response to be sent"]
3133#[derive(Debug)]
3134pub struct WlanPhyGetTxPowerScenarioResponder {
3135    control_handle: std::mem::ManuallyDrop<WlanPhyControlHandle>,
3136    tx_id: u32,
3137}
3138
3139/// Set the the channel to be shutdown (see [`WlanPhyControlHandle::shutdown`])
3140/// if the responder is dropped without sending a response, so that the client
3141/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3142impl std::ops::Drop for WlanPhyGetTxPowerScenarioResponder {
3143    fn drop(&mut self) {
3144        self.control_handle.shutdown();
3145        // Safety: drops once, never accessed again
3146        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3147    }
3148}
3149
3150impl fidl::endpoints::Responder for WlanPhyGetTxPowerScenarioResponder {
3151    type ControlHandle = WlanPhyControlHandle;
3152
3153    fn control_handle(&self) -> &WlanPhyControlHandle {
3154        &self.control_handle
3155    }
3156
3157    fn drop_without_shutdown(mut self) {
3158        // Safety: drops once, never accessed again due to mem::forget
3159        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3160        // Prevent Drop from running (which would shut down the channel)
3161        std::mem::forget(self);
3162    }
3163}
3164
3165impl WlanPhyGetTxPowerScenarioResponder {
3166    /// Sends a response to the FIDL transaction.
3167    ///
3168    /// Sets the channel to shutdown if an error occurs.
3169    pub fn send(
3170        self,
3171        mut result: Result<fidl_fuchsia_wlan_internal::TxPowerScenario, i32>,
3172    ) -> Result<(), fidl::Error> {
3173        let _result = self.send_raw(result);
3174        if _result.is_err() {
3175            self.control_handle.shutdown();
3176        }
3177        self.drop_without_shutdown();
3178        _result
3179    }
3180
3181    /// Similar to "send" but does not shutdown the channel if an error occurs.
3182    pub fn send_no_shutdown_on_err(
3183        self,
3184        mut result: Result<fidl_fuchsia_wlan_internal::TxPowerScenario, i32>,
3185    ) -> Result<(), fidl::Error> {
3186        let _result = self.send_raw(result);
3187        self.drop_without_shutdown();
3188        _result
3189    }
3190
3191    fn send_raw(
3192        &self,
3193        mut result: Result<fidl_fuchsia_wlan_internal::TxPowerScenario, i32>,
3194    ) -> Result<(), fidl::Error> {
3195        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3196            WlanPhyGetTxPowerScenarioResponse,
3197            i32,
3198        >>(
3199            fidl::encoding::FlexibleResult::new(result.map(|scenario| (scenario,))),
3200            self.tx_id,
3201            0x62f9717d964b3c8e,
3202            fidl::encoding::DynamicFlags::FLEXIBLE,
3203        )
3204    }
3205}
3206
3207#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3208pub struct WlanPhyNotifyMarker;
3209
3210impl fidl::endpoints::ProtocolMarker for WlanPhyNotifyMarker {
3211    type Proxy = WlanPhyNotifyProxy;
3212    type RequestStream = WlanPhyNotifyRequestStream;
3213    #[cfg(target_os = "fuchsia")]
3214    type SynchronousProxy = WlanPhyNotifySynchronousProxy;
3215
3216    const DEBUG_NAME: &'static str = "fuchsia.wlan.phy.WlanPhyNotify";
3217}
3218impl fidl::endpoints::DiscoverableProtocolMarker for WlanPhyNotifyMarker {}
3219pub type WlanPhyNotifyOnCriticalErrorResult = Result<(), WlanPhyNotifyError>;
3220pub type WlanPhyNotifyOnCountryCodeChangeResult = Result<(), WlanPhyNotifyError>;
3221
3222pub trait WlanPhyNotifyProxyInterface: Send + Sync {
3223    type OnCriticalErrorResponseFut: std::future::Future<Output = Result<WlanPhyNotifyOnCriticalErrorResult, fidl::Error>>
3224        + Send;
3225    fn r#on_critical_error(
3226        &self,
3227        payload: &WlanPhyNotifyOnCriticalErrorRequest,
3228    ) -> Self::OnCriticalErrorResponseFut;
3229    type OnCountryCodeChangeResponseFut: std::future::Future<Output = Result<WlanPhyNotifyOnCountryCodeChangeResult, fidl::Error>>
3230        + Send;
3231    fn r#on_country_code_change(
3232        &self,
3233        payload: &WlanPhyNotifyOnCountryCodeChangeRequest,
3234    ) -> Self::OnCountryCodeChangeResponseFut;
3235}
3236#[derive(Debug)]
3237#[cfg(target_os = "fuchsia")]
3238pub struct WlanPhyNotifySynchronousProxy {
3239    client: fidl::client::sync::Client,
3240}
3241
3242#[cfg(target_os = "fuchsia")]
3243impl fidl::endpoints::SynchronousProxy for WlanPhyNotifySynchronousProxy {
3244    type Proxy = WlanPhyNotifyProxy;
3245    type Protocol = WlanPhyNotifyMarker;
3246
3247    fn from_channel(inner: fidl::Channel) -> Self {
3248        Self::new(inner)
3249    }
3250
3251    fn into_channel(self) -> fidl::Channel {
3252        self.client.into_channel()
3253    }
3254
3255    fn as_channel(&self) -> &fidl::Channel {
3256        self.client.as_channel()
3257    }
3258}
3259
3260#[cfg(target_os = "fuchsia")]
3261impl WlanPhyNotifySynchronousProxy {
3262    pub fn new(channel: fidl::Channel) -> Self {
3263        Self { client: fidl::client::sync::Client::new(channel) }
3264    }
3265
3266    pub fn into_channel(self) -> fidl::Channel {
3267        self.client.into_channel()
3268    }
3269
3270    /// Waits until an event arrives and returns it. It is safe for other
3271    /// threads to make concurrent requests while waiting for an event.
3272    pub fn wait_for_event(
3273        &self,
3274        deadline: zx::MonotonicInstant,
3275    ) -> Result<WlanPhyNotifyEvent, fidl::Error> {
3276        WlanPhyNotifyEvent::decode(self.client.wait_for_event::<WlanPhyNotifyMarker>(deadline)?)
3277    }
3278
3279    /// Indicate to the receiver that the PHY has encountered a critical
3280    /// error specifying a reason code.
3281    pub fn r#on_critical_error(
3282        &self,
3283        mut payload: &WlanPhyNotifyOnCriticalErrorRequest,
3284        ___deadline: zx::MonotonicInstant,
3285    ) -> Result<WlanPhyNotifyOnCriticalErrorResult, fidl::Error> {
3286        let _response = self.client.send_query::<
3287            WlanPhyNotifyOnCriticalErrorRequest,
3288            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, WlanPhyNotifyError>,
3289            WlanPhyNotifyMarker,
3290        >(
3291            payload,
3292            0x621a4bea612fda2,
3293            fidl::encoding::DynamicFlags::FLEXIBLE,
3294            ___deadline,
3295        )?
3296        .into_result::<WlanPhyNotifyMarker>("on_critical_error")?;
3297        Ok(_response.map(|x| x))
3298    }
3299
3300    /// Indicate to the receiver that the firmware running on wlan hardware
3301    /// has detected a change in country code.
3302    pub fn r#on_country_code_change(
3303        &self,
3304        mut payload: &WlanPhyNotifyOnCountryCodeChangeRequest,
3305        ___deadline: zx::MonotonicInstant,
3306    ) -> Result<WlanPhyNotifyOnCountryCodeChangeResult, fidl::Error> {
3307        let _response = self.client.send_query::<
3308            WlanPhyNotifyOnCountryCodeChangeRequest,
3309            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, WlanPhyNotifyError>,
3310            WlanPhyNotifyMarker,
3311        >(
3312            payload,
3313            0x9db74ddfe1fa156,
3314            fidl::encoding::DynamicFlags::FLEXIBLE,
3315            ___deadline,
3316        )?
3317        .into_result::<WlanPhyNotifyMarker>("on_country_code_change")?;
3318        Ok(_response.map(|x| x))
3319    }
3320}
3321
3322#[cfg(target_os = "fuchsia")]
3323impl From<WlanPhyNotifySynchronousProxy> for zx::NullableHandle {
3324    fn from(value: WlanPhyNotifySynchronousProxy) -> Self {
3325        value.into_channel().into()
3326    }
3327}
3328
3329#[cfg(target_os = "fuchsia")]
3330impl From<fidl::Channel> for WlanPhyNotifySynchronousProxy {
3331    fn from(value: fidl::Channel) -> Self {
3332        Self::new(value)
3333    }
3334}
3335
3336#[cfg(target_os = "fuchsia")]
3337impl fidl::endpoints::FromClient for WlanPhyNotifySynchronousProxy {
3338    type Protocol = WlanPhyNotifyMarker;
3339
3340    fn from_client(value: fidl::endpoints::ClientEnd<WlanPhyNotifyMarker>) -> Self {
3341        Self::new(value.into_channel())
3342    }
3343}
3344
3345#[derive(Debug, Clone)]
3346pub struct WlanPhyNotifyProxy {
3347    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3348}
3349
3350impl fidl::endpoints::Proxy for WlanPhyNotifyProxy {
3351    type Protocol = WlanPhyNotifyMarker;
3352
3353    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3354        Self::new(inner)
3355    }
3356
3357    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3358        self.client.into_channel().map_err(|client| Self { client })
3359    }
3360
3361    fn as_channel(&self) -> &::fidl::AsyncChannel {
3362        self.client.as_channel()
3363    }
3364}
3365
3366impl WlanPhyNotifyProxy {
3367    /// Create a new Proxy for fuchsia.wlan.phy/WlanPhyNotify.
3368    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3369        let protocol_name = <WlanPhyNotifyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3370        Self { client: fidl::client::Client::new(channel, protocol_name) }
3371    }
3372
3373    /// Get a Stream of events from the remote end of the protocol.
3374    ///
3375    /// # Panics
3376    ///
3377    /// Panics if the event stream was already taken.
3378    pub fn take_event_stream(&self) -> WlanPhyNotifyEventStream {
3379        WlanPhyNotifyEventStream { event_receiver: self.client.take_event_receiver() }
3380    }
3381
3382    /// Indicate to the receiver that the PHY has encountered a critical
3383    /// error specifying a reason code.
3384    pub fn r#on_critical_error(
3385        &self,
3386        mut payload: &WlanPhyNotifyOnCriticalErrorRequest,
3387    ) -> fidl::client::QueryResponseFut<
3388        WlanPhyNotifyOnCriticalErrorResult,
3389        fidl::encoding::DefaultFuchsiaResourceDialect,
3390    > {
3391        WlanPhyNotifyProxyInterface::r#on_critical_error(self, payload)
3392    }
3393
3394    /// Indicate to the receiver that the firmware running on wlan hardware
3395    /// has detected a change in country code.
3396    pub fn r#on_country_code_change(
3397        &self,
3398        mut payload: &WlanPhyNotifyOnCountryCodeChangeRequest,
3399    ) -> fidl::client::QueryResponseFut<
3400        WlanPhyNotifyOnCountryCodeChangeResult,
3401        fidl::encoding::DefaultFuchsiaResourceDialect,
3402    > {
3403        WlanPhyNotifyProxyInterface::r#on_country_code_change(self, payload)
3404    }
3405}
3406
3407impl WlanPhyNotifyProxyInterface for WlanPhyNotifyProxy {
3408    type OnCriticalErrorResponseFut = fidl::client::QueryResponseFut<
3409        WlanPhyNotifyOnCriticalErrorResult,
3410        fidl::encoding::DefaultFuchsiaResourceDialect,
3411    >;
3412    fn r#on_critical_error(
3413        &self,
3414        mut payload: &WlanPhyNotifyOnCriticalErrorRequest,
3415    ) -> Self::OnCriticalErrorResponseFut {
3416        fn _decode(
3417            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3418        ) -> Result<WlanPhyNotifyOnCriticalErrorResult, fidl::Error> {
3419            let _response = fidl::client::decode_transaction_body::<
3420                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, WlanPhyNotifyError>,
3421                fidl::encoding::DefaultFuchsiaResourceDialect,
3422                0x621a4bea612fda2,
3423            >(_buf?)?
3424            .into_result::<WlanPhyNotifyMarker>("on_critical_error")?;
3425            Ok(_response.map(|x| x))
3426        }
3427        self.client.send_query_and_decode::<
3428            WlanPhyNotifyOnCriticalErrorRequest,
3429            WlanPhyNotifyOnCriticalErrorResult,
3430        >(
3431            payload,
3432            0x621a4bea612fda2,
3433            fidl::encoding::DynamicFlags::FLEXIBLE,
3434            _decode,
3435        )
3436    }
3437
3438    type OnCountryCodeChangeResponseFut = fidl::client::QueryResponseFut<
3439        WlanPhyNotifyOnCountryCodeChangeResult,
3440        fidl::encoding::DefaultFuchsiaResourceDialect,
3441    >;
3442    fn r#on_country_code_change(
3443        &self,
3444        mut payload: &WlanPhyNotifyOnCountryCodeChangeRequest,
3445    ) -> Self::OnCountryCodeChangeResponseFut {
3446        fn _decode(
3447            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3448        ) -> Result<WlanPhyNotifyOnCountryCodeChangeResult, fidl::Error> {
3449            let _response = fidl::client::decode_transaction_body::<
3450                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, WlanPhyNotifyError>,
3451                fidl::encoding::DefaultFuchsiaResourceDialect,
3452                0x9db74ddfe1fa156,
3453            >(_buf?)?
3454            .into_result::<WlanPhyNotifyMarker>("on_country_code_change")?;
3455            Ok(_response.map(|x| x))
3456        }
3457        self.client.send_query_and_decode::<
3458            WlanPhyNotifyOnCountryCodeChangeRequest,
3459            WlanPhyNotifyOnCountryCodeChangeResult,
3460        >(
3461            payload,
3462            0x9db74ddfe1fa156,
3463            fidl::encoding::DynamicFlags::FLEXIBLE,
3464            _decode,
3465        )
3466    }
3467}
3468
3469pub struct WlanPhyNotifyEventStream {
3470    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3471}
3472
3473impl std::marker::Unpin for WlanPhyNotifyEventStream {}
3474
3475impl futures::stream::FusedStream for WlanPhyNotifyEventStream {
3476    fn is_terminated(&self) -> bool {
3477        self.event_receiver.is_terminated()
3478    }
3479}
3480
3481impl futures::Stream for WlanPhyNotifyEventStream {
3482    type Item = Result<WlanPhyNotifyEvent, fidl::Error>;
3483
3484    fn poll_next(
3485        mut self: std::pin::Pin<&mut Self>,
3486        cx: &mut std::task::Context<'_>,
3487    ) -> std::task::Poll<Option<Self::Item>> {
3488        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3489            &mut self.event_receiver,
3490            cx
3491        )?) {
3492            Some(buf) => std::task::Poll::Ready(Some(WlanPhyNotifyEvent::decode(buf))),
3493            None => std::task::Poll::Ready(None),
3494        }
3495    }
3496}
3497
3498#[derive(Debug)]
3499pub enum WlanPhyNotifyEvent {
3500    #[non_exhaustive]
3501    _UnknownEvent {
3502        /// Ordinal of the event that was sent.
3503        ordinal: u64,
3504    },
3505}
3506
3507impl WlanPhyNotifyEvent {
3508    /// Decodes a message buffer as a [`WlanPhyNotifyEvent`].
3509    fn decode(
3510        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3511    ) -> Result<WlanPhyNotifyEvent, fidl::Error> {
3512        let (bytes, _handles) = buf.split_mut();
3513        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3514        debug_assert_eq!(tx_header.tx_id, 0);
3515        match tx_header.ordinal {
3516            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3517                Ok(WlanPhyNotifyEvent::_UnknownEvent { ordinal: tx_header.ordinal })
3518            }
3519            _ => Err(fidl::Error::UnknownOrdinal {
3520                ordinal: tx_header.ordinal,
3521                protocol_name: <WlanPhyNotifyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3522            }),
3523        }
3524    }
3525}
3526
3527/// A Stream of incoming requests for fuchsia.wlan.phy/WlanPhyNotify.
3528pub struct WlanPhyNotifyRequestStream {
3529    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3530    is_terminated: bool,
3531}
3532
3533impl std::marker::Unpin for WlanPhyNotifyRequestStream {}
3534
3535impl futures::stream::FusedStream for WlanPhyNotifyRequestStream {
3536    fn is_terminated(&self) -> bool {
3537        self.is_terminated
3538    }
3539}
3540
3541impl fidl::endpoints::RequestStream for WlanPhyNotifyRequestStream {
3542    type Protocol = WlanPhyNotifyMarker;
3543    type ControlHandle = WlanPhyNotifyControlHandle;
3544
3545    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3546        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3547    }
3548
3549    fn control_handle(&self) -> Self::ControlHandle {
3550        WlanPhyNotifyControlHandle { inner: self.inner.clone() }
3551    }
3552
3553    fn into_inner(
3554        self,
3555    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3556    {
3557        (self.inner, self.is_terminated)
3558    }
3559
3560    fn from_inner(
3561        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3562        is_terminated: bool,
3563    ) -> Self {
3564        Self { inner, is_terminated }
3565    }
3566}
3567
3568impl futures::Stream for WlanPhyNotifyRequestStream {
3569    type Item = Result<WlanPhyNotifyRequest, fidl::Error>;
3570
3571    fn poll_next(
3572        mut self: std::pin::Pin<&mut Self>,
3573        cx: &mut std::task::Context<'_>,
3574    ) -> std::task::Poll<Option<Self::Item>> {
3575        let this = &mut *self;
3576        if this.inner.check_shutdown(cx) {
3577            this.is_terminated = true;
3578            return std::task::Poll::Ready(None);
3579        }
3580        if this.is_terminated {
3581            panic!("polled WlanPhyNotifyRequestStream after completion");
3582        }
3583        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3584            |bytes, handles| {
3585                match this.inner.channel().read_etc(cx, bytes, handles) {
3586                    std::task::Poll::Ready(Ok(())) => {}
3587                    std::task::Poll::Pending => return std::task::Poll::Pending,
3588                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3589                        this.is_terminated = true;
3590                        return std::task::Poll::Ready(None);
3591                    }
3592                    std::task::Poll::Ready(Err(e)) => {
3593                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3594                            e.into(),
3595                        ))));
3596                    }
3597                }
3598
3599                // A message has been received from the channel
3600                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3601
3602                std::task::Poll::Ready(Some(match header.ordinal {
3603                    0x621a4bea612fda2 => {
3604                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3605                        let mut req = fidl::new_empty!(
3606                            WlanPhyNotifyOnCriticalErrorRequest,
3607                            fidl::encoding::DefaultFuchsiaResourceDialect
3608                        );
3609                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WlanPhyNotifyOnCriticalErrorRequest>(&header, _body_bytes, handles, &mut req)?;
3610                        let control_handle =
3611                            WlanPhyNotifyControlHandle { inner: this.inner.clone() };
3612                        Ok(WlanPhyNotifyRequest::OnCriticalError {
3613                            payload: req,
3614                            responder: WlanPhyNotifyOnCriticalErrorResponder {
3615                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3616                                tx_id: header.tx_id,
3617                            },
3618                        })
3619                    }
3620                    0x9db74ddfe1fa156 => {
3621                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3622                        let mut req = fidl::new_empty!(
3623                            WlanPhyNotifyOnCountryCodeChangeRequest,
3624                            fidl::encoding::DefaultFuchsiaResourceDialect
3625                        );
3626                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WlanPhyNotifyOnCountryCodeChangeRequest>(&header, _body_bytes, handles, &mut req)?;
3627                        let control_handle =
3628                            WlanPhyNotifyControlHandle { inner: this.inner.clone() };
3629                        Ok(WlanPhyNotifyRequest::OnCountryCodeChange {
3630                            payload: req,
3631                            responder: WlanPhyNotifyOnCountryCodeChangeResponder {
3632                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3633                                tx_id: header.tx_id,
3634                            },
3635                        })
3636                    }
3637                    _ if header.tx_id == 0
3638                        && header
3639                            .dynamic_flags()
3640                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3641                    {
3642                        Ok(WlanPhyNotifyRequest::_UnknownMethod {
3643                            ordinal: header.ordinal,
3644                            control_handle: WlanPhyNotifyControlHandle {
3645                                inner: this.inner.clone(),
3646                            },
3647                            method_type: fidl::MethodType::OneWay,
3648                        })
3649                    }
3650                    _ if header
3651                        .dynamic_flags()
3652                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3653                    {
3654                        this.inner.send_framework_err(
3655                            fidl::encoding::FrameworkErr::UnknownMethod,
3656                            header.tx_id,
3657                            header.ordinal,
3658                            header.dynamic_flags(),
3659                            (bytes, handles),
3660                        )?;
3661                        Ok(WlanPhyNotifyRequest::_UnknownMethod {
3662                            ordinal: header.ordinal,
3663                            control_handle: WlanPhyNotifyControlHandle {
3664                                inner: this.inner.clone(),
3665                            },
3666                            method_type: fidl::MethodType::TwoWay,
3667                        })
3668                    }
3669                    _ => Err(fidl::Error::UnknownOrdinal {
3670                        ordinal: header.ordinal,
3671                        protocol_name:
3672                            <WlanPhyNotifyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3673                    }),
3674                }))
3675            },
3676        )
3677    }
3678}
3679
3680/// This protocol is specifically meant for passing events/notifications from the WlanPhy server
3681/// to its client.
3682#[derive(Debug)]
3683pub enum WlanPhyNotifyRequest {
3684    /// Indicate to the receiver that the PHY has encountered a critical
3685    /// error specifying a reason code.
3686    OnCriticalError {
3687        payload: WlanPhyNotifyOnCriticalErrorRequest,
3688        responder: WlanPhyNotifyOnCriticalErrorResponder,
3689    },
3690    /// Indicate to the receiver that the firmware running on wlan hardware
3691    /// has detected a change in country code.
3692    OnCountryCodeChange {
3693        payload: WlanPhyNotifyOnCountryCodeChangeRequest,
3694        responder: WlanPhyNotifyOnCountryCodeChangeResponder,
3695    },
3696    /// An interaction was received which does not match any known method.
3697    #[non_exhaustive]
3698    _UnknownMethod {
3699        /// Ordinal of the method that was called.
3700        ordinal: u64,
3701        control_handle: WlanPhyNotifyControlHandle,
3702        method_type: fidl::MethodType,
3703    },
3704}
3705
3706impl WlanPhyNotifyRequest {
3707    #[allow(irrefutable_let_patterns)]
3708    pub fn into_on_critical_error(
3709        self,
3710    ) -> Option<(WlanPhyNotifyOnCriticalErrorRequest, WlanPhyNotifyOnCriticalErrorResponder)> {
3711        if let WlanPhyNotifyRequest::OnCriticalError { payload, responder } = self {
3712            Some((payload, responder))
3713        } else {
3714            None
3715        }
3716    }
3717
3718    #[allow(irrefutable_let_patterns)]
3719    pub fn into_on_country_code_change(
3720        self,
3721    ) -> Option<(WlanPhyNotifyOnCountryCodeChangeRequest, WlanPhyNotifyOnCountryCodeChangeResponder)>
3722    {
3723        if let WlanPhyNotifyRequest::OnCountryCodeChange { payload, responder } = self {
3724            Some((payload, responder))
3725        } else {
3726            None
3727        }
3728    }
3729
3730    /// Name of the method defined in FIDL
3731    pub fn method_name(&self) -> &'static str {
3732        match *self {
3733            WlanPhyNotifyRequest::OnCriticalError { .. } => "on_critical_error",
3734            WlanPhyNotifyRequest::OnCountryCodeChange { .. } => "on_country_code_change",
3735            WlanPhyNotifyRequest::_UnknownMethod {
3736                method_type: fidl::MethodType::OneWay, ..
3737            } => "unknown one-way method",
3738            WlanPhyNotifyRequest::_UnknownMethod {
3739                method_type: fidl::MethodType::TwoWay, ..
3740            } => "unknown two-way method",
3741        }
3742    }
3743}
3744
3745#[derive(Debug, Clone)]
3746pub struct WlanPhyNotifyControlHandle {
3747    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3748}
3749
3750impl fidl::endpoints::ControlHandle for WlanPhyNotifyControlHandle {
3751    fn shutdown(&self) {
3752        self.inner.shutdown()
3753    }
3754
3755    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3756        self.inner.shutdown_with_epitaph(status)
3757    }
3758
3759    fn is_closed(&self) -> bool {
3760        self.inner.channel().is_closed()
3761    }
3762    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3763        self.inner.channel().on_closed()
3764    }
3765
3766    #[cfg(target_os = "fuchsia")]
3767    fn signal_peer(
3768        &self,
3769        clear_mask: zx::Signals,
3770        set_mask: zx::Signals,
3771    ) -> Result<(), zx_status::Status> {
3772        use fidl::Peered;
3773        self.inner.channel().signal_peer(clear_mask, set_mask)
3774    }
3775}
3776
3777impl WlanPhyNotifyControlHandle {}
3778
3779#[must_use = "FIDL methods require a response to be sent"]
3780#[derive(Debug)]
3781pub struct WlanPhyNotifyOnCriticalErrorResponder {
3782    control_handle: std::mem::ManuallyDrop<WlanPhyNotifyControlHandle>,
3783    tx_id: u32,
3784}
3785
3786/// Set the the channel to be shutdown (see [`WlanPhyNotifyControlHandle::shutdown`])
3787/// if the responder is dropped without sending a response, so that the client
3788/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3789impl std::ops::Drop for WlanPhyNotifyOnCriticalErrorResponder {
3790    fn drop(&mut self) {
3791        self.control_handle.shutdown();
3792        // Safety: drops once, never accessed again
3793        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3794    }
3795}
3796
3797impl fidl::endpoints::Responder for WlanPhyNotifyOnCriticalErrorResponder {
3798    type ControlHandle = WlanPhyNotifyControlHandle;
3799
3800    fn control_handle(&self) -> &WlanPhyNotifyControlHandle {
3801        &self.control_handle
3802    }
3803
3804    fn drop_without_shutdown(mut self) {
3805        // Safety: drops once, never accessed again due to mem::forget
3806        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3807        // Prevent Drop from running (which would shut down the channel)
3808        std::mem::forget(self);
3809    }
3810}
3811
3812impl WlanPhyNotifyOnCriticalErrorResponder {
3813    /// Sends a response to the FIDL transaction.
3814    ///
3815    /// Sets the channel to shutdown if an error occurs.
3816    pub fn send(self, mut result: Result<(), WlanPhyNotifyError>) -> Result<(), fidl::Error> {
3817        let _result = self.send_raw(result);
3818        if _result.is_err() {
3819            self.control_handle.shutdown();
3820        }
3821        self.drop_without_shutdown();
3822        _result
3823    }
3824
3825    /// Similar to "send" but does not shutdown the channel if an error occurs.
3826    pub fn send_no_shutdown_on_err(
3827        self,
3828        mut result: Result<(), WlanPhyNotifyError>,
3829    ) -> Result<(), fidl::Error> {
3830        let _result = self.send_raw(result);
3831        self.drop_without_shutdown();
3832        _result
3833    }
3834
3835    fn send_raw(&self, mut result: Result<(), WlanPhyNotifyError>) -> Result<(), fidl::Error> {
3836        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3837            fidl::encoding::EmptyStruct,
3838            WlanPhyNotifyError,
3839        >>(
3840            fidl::encoding::FlexibleResult::new(result),
3841            self.tx_id,
3842            0x621a4bea612fda2,
3843            fidl::encoding::DynamicFlags::FLEXIBLE,
3844        )
3845    }
3846}
3847
3848#[must_use = "FIDL methods require a response to be sent"]
3849#[derive(Debug)]
3850pub struct WlanPhyNotifyOnCountryCodeChangeResponder {
3851    control_handle: std::mem::ManuallyDrop<WlanPhyNotifyControlHandle>,
3852    tx_id: u32,
3853}
3854
3855/// Set the the channel to be shutdown (see [`WlanPhyNotifyControlHandle::shutdown`])
3856/// if the responder is dropped without sending a response, so that the client
3857/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3858impl std::ops::Drop for WlanPhyNotifyOnCountryCodeChangeResponder {
3859    fn drop(&mut self) {
3860        self.control_handle.shutdown();
3861        // Safety: drops once, never accessed again
3862        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3863    }
3864}
3865
3866impl fidl::endpoints::Responder for WlanPhyNotifyOnCountryCodeChangeResponder {
3867    type ControlHandle = WlanPhyNotifyControlHandle;
3868
3869    fn control_handle(&self) -> &WlanPhyNotifyControlHandle {
3870        &self.control_handle
3871    }
3872
3873    fn drop_without_shutdown(mut self) {
3874        // Safety: drops once, never accessed again due to mem::forget
3875        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3876        // Prevent Drop from running (which would shut down the channel)
3877        std::mem::forget(self);
3878    }
3879}
3880
3881impl WlanPhyNotifyOnCountryCodeChangeResponder {
3882    /// Sends a response to the FIDL transaction.
3883    ///
3884    /// Sets the channel to shutdown if an error occurs.
3885    pub fn send(self, mut result: Result<(), WlanPhyNotifyError>) -> Result<(), fidl::Error> {
3886        let _result = self.send_raw(result);
3887        if _result.is_err() {
3888            self.control_handle.shutdown();
3889        }
3890        self.drop_without_shutdown();
3891        _result
3892    }
3893
3894    /// Similar to "send" but does not shutdown the channel if an error occurs.
3895    pub fn send_no_shutdown_on_err(
3896        self,
3897        mut result: Result<(), WlanPhyNotifyError>,
3898    ) -> Result<(), fidl::Error> {
3899        let _result = self.send_raw(result);
3900        self.drop_without_shutdown();
3901        _result
3902    }
3903
3904    fn send_raw(&self, mut result: Result<(), WlanPhyNotifyError>) -> Result<(), fidl::Error> {
3905        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3906            fidl::encoding::EmptyStruct,
3907            WlanPhyNotifyError,
3908        >>(
3909            fidl::encoding::FlexibleResult::new(result),
3910            self.tx_id,
3911            0x9db74ddfe1fa156,
3912            fidl::encoding::DynamicFlags::FLEXIBLE,
3913        )
3914    }
3915}
3916
3917#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3918pub struct ServiceMarker;
3919
3920#[cfg(target_os = "fuchsia")]
3921impl fidl::endpoints::ServiceMarker for ServiceMarker {
3922    type Proxy = ServiceProxy;
3923    type Request = ServiceRequest;
3924    const SERVICE_NAME: &'static str = "fuchsia.wlan.phy.Service";
3925}
3926
3927/// A request for one of the member protocols of Service.
3928///
3929#[cfg(target_os = "fuchsia")]
3930pub enum ServiceRequest {
3931    Device(WlanPhyRequestStream),
3932}
3933
3934#[cfg(target_os = "fuchsia")]
3935impl fidl::endpoints::ServiceRequest for ServiceRequest {
3936    type Service = ServiceMarker;
3937
3938    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
3939        match name {
3940            "device" => Self::Device(
3941                <WlanPhyRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
3942            ),
3943            _ => panic!("no such member protocol name for service Service"),
3944        }
3945    }
3946
3947    fn member_names() -> &'static [&'static str] {
3948        &["device"]
3949    }
3950}
3951#[cfg(target_os = "fuchsia")]
3952pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
3953
3954#[cfg(target_os = "fuchsia")]
3955impl fidl::endpoints::ServiceProxy for ServiceProxy {
3956    type Service = ServiceMarker;
3957
3958    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
3959        Self(opener)
3960    }
3961}
3962
3963#[cfg(target_os = "fuchsia")]
3964impl ServiceProxy {
3965    pub fn connect_to_device(&self) -> Result<WlanPhyProxy, fidl::Error> {
3966        let (proxy, server_end) = fidl::endpoints::create_proxy::<WlanPhyMarker>();
3967        self.connect_channel_to_device(server_end)?;
3968        Ok(proxy)
3969    }
3970
3971    /// Like `connect_to_device`, but returns a sync proxy.
3972    /// See [`Self::connect_to_device`] for more details.
3973    pub fn connect_to_device_sync(&self) -> Result<WlanPhySynchronousProxy, fidl::Error> {
3974        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<WlanPhyMarker>();
3975        self.connect_channel_to_device(server_end)?;
3976        Ok(proxy)
3977    }
3978
3979    /// Like `connect_to_device`, but accepts a server end.
3980    /// See [`Self::connect_to_device`] for more details.
3981    pub fn connect_channel_to_device(
3982        &self,
3983        server_end: fidl::endpoints::ServerEnd<WlanPhyMarker>,
3984    ) -> Result<(), fidl::Error> {
3985        self.0.open_member("device", server_end.into_channel())
3986    }
3987
3988    pub fn instance_name(&self) -> &str {
3989        self.0.instance_name()
3990    }
3991}
3992
3993mod internal {
3994    use super::*;
3995
3996    impl WlanPhyCreateIfaceRequest {
3997        #[inline(always)]
3998        fn max_ordinal_present(&self) -> u64 {
3999            if let Some(_) = self.init_sta_addr {
4000                return 3;
4001            }
4002            if let Some(_) = self.mlme_channel {
4003                return 2;
4004            }
4005            if let Some(_) = self.role {
4006                return 1;
4007            }
4008            0
4009        }
4010    }
4011
4012    impl fidl::encoding::ResourceTypeMarker for WlanPhyCreateIfaceRequest {
4013        type Borrowed<'a> = &'a mut Self;
4014        fn take_or_borrow<'a>(
4015            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4016        ) -> Self::Borrowed<'a> {
4017            value
4018        }
4019    }
4020
4021    unsafe impl fidl::encoding::TypeMarker for WlanPhyCreateIfaceRequest {
4022        type Owned = Self;
4023
4024        #[inline(always)]
4025        fn inline_align(_context: fidl::encoding::Context) -> usize {
4026            8
4027        }
4028
4029        #[inline(always)]
4030        fn inline_size(_context: fidl::encoding::Context) -> usize {
4031            16
4032        }
4033    }
4034
4035    unsafe impl
4036        fidl::encoding::Encode<
4037            WlanPhyCreateIfaceRequest,
4038            fidl::encoding::DefaultFuchsiaResourceDialect,
4039        > for &mut WlanPhyCreateIfaceRequest
4040    {
4041        unsafe fn encode(
4042            self,
4043            encoder: &mut fidl::encoding::Encoder<
4044                '_,
4045                fidl::encoding::DefaultFuchsiaResourceDialect,
4046            >,
4047            offset: usize,
4048            mut depth: fidl::encoding::Depth,
4049        ) -> fidl::Result<()> {
4050            encoder.debug_check_bounds::<WlanPhyCreateIfaceRequest>(offset);
4051            // Vector header
4052            let max_ordinal: u64 = self.max_ordinal_present();
4053            encoder.write_num(max_ordinal, offset);
4054            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4055            // Calling encoder.out_of_line_offset(0) is not allowed.
4056            if max_ordinal == 0 {
4057                return Ok(());
4058            }
4059            depth.increment()?;
4060            let envelope_size = 8;
4061            let bytes_len = max_ordinal as usize * envelope_size;
4062            #[allow(unused_variables)]
4063            let offset = encoder.out_of_line_offset(bytes_len);
4064            let mut _prev_end_offset: usize = 0;
4065            if 1 > max_ordinal {
4066                return Ok(());
4067            }
4068
4069            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4070            // are envelope_size bytes.
4071            let cur_offset: usize = (1 - 1) * envelope_size;
4072
4073            // Zero reserved fields.
4074            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4075
4076            // Safety:
4077            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4078            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4079            //   envelope_size bytes, there is always sufficient room.
4080            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_wlan_common::WlanMacRole, fidl::encoding::DefaultFuchsiaResourceDialect>(
4081            self.role.as_ref().map(<fidl_fuchsia_wlan_common::WlanMacRole as fidl::encoding::ValueTypeMarker>::borrow),
4082            encoder, offset + cur_offset, depth
4083        )?;
4084
4085            _prev_end_offset = cur_offset + envelope_size;
4086            if 2 > max_ordinal {
4087                return Ok(());
4088            }
4089
4090            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4091            // are envelope_size bytes.
4092            let cur_offset: usize = (2 - 1) * envelope_size;
4093
4094            // Zero reserved fields.
4095            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4096
4097            // Safety:
4098            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4099            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4100            //   envelope_size bytes, there is always sufficient room.
4101            fidl::encoding::encode_in_envelope_optional::<
4102                fidl::encoding::HandleType<
4103                    fidl::Channel,
4104                    { fidl::ObjectType::CHANNEL.into_raw() },
4105                    2147483648,
4106                >,
4107                fidl::encoding::DefaultFuchsiaResourceDialect,
4108            >(
4109                self.mlme_channel.as_mut().map(
4110                    <fidl::encoding::HandleType<
4111                        fidl::Channel,
4112                        { fidl::ObjectType::CHANNEL.into_raw() },
4113                        2147483648,
4114                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
4115                ),
4116                encoder,
4117                offset + cur_offset,
4118                depth,
4119            )?;
4120
4121            _prev_end_offset = cur_offset + envelope_size;
4122            if 3 > max_ordinal {
4123                return Ok(());
4124            }
4125
4126            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4127            // are envelope_size bytes.
4128            let cur_offset: usize = (3 - 1) * envelope_size;
4129
4130            // Zero reserved fields.
4131            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4132
4133            // Safety:
4134            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4135            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4136            //   envelope_size bytes, there is always sufficient room.
4137            fidl::encoding::encode_in_envelope_optional::<
4138                fidl::encoding::Array<u8, 6>,
4139                fidl::encoding::DefaultFuchsiaResourceDialect,
4140            >(
4141                self.init_sta_addr
4142                    .as_ref()
4143                    .map(<fidl::encoding::Array<u8, 6> as fidl::encoding::ValueTypeMarker>::borrow),
4144                encoder,
4145                offset + cur_offset,
4146                depth,
4147            )?;
4148
4149            _prev_end_offset = cur_offset + envelope_size;
4150
4151            Ok(())
4152        }
4153    }
4154
4155    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4156        for WlanPhyCreateIfaceRequest
4157    {
4158        #[inline(always)]
4159        fn new_empty() -> Self {
4160            Self::default()
4161        }
4162
4163        unsafe fn decode(
4164            &mut self,
4165            decoder: &mut fidl::encoding::Decoder<
4166                '_,
4167                fidl::encoding::DefaultFuchsiaResourceDialect,
4168            >,
4169            offset: usize,
4170            mut depth: fidl::encoding::Depth,
4171        ) -> fidl::Result<()> {
4172            decoder.debug_check_bounds::<Self>(offset);
4173            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4174                None => return Err(fidl::Error::NotNullable),
4175                Some(len) => len,
4176            };
4177            // Calling decoder.out_of_line_offset(0) is not allowed.
4178            if len == 0 {
4179                return Ok(());
4180            };
4181            depth.increment()?;
4182            let envelope_size = 8;
4183            let bytes_len = len * envelope_size;
4184            let offset = decoder.out_of_line_offset(bytes_len)?;
4185            // Decode the envelope for each type.
4186            let mut _next_ordinal_to_read = 0;
4187            let mut next_offset = offset;
4188            let end_offset = offset + bytes_len;
4189            _next_ordinal_to_read += 1;
4190            if next_offset >= end_offset {
4191                return Ok(());
4192            }
4193
4194            // Decode unknown envelopes for gaps in ordinals.
4195            while _next_ordinal_to_read < 1 {
4196                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4197                _next_ordinal_to_read += 1;
4198                next_offset += envelope_size;
4199            }
4200
4201            let next_out_of_line = decoder.next_out_of_line();
4202            let handles_before = decoder.remaining_handles();
4203            if let Some((inlined, num_bytes, num_handles)) =
4204                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4205            {
4206                let member_inline_size = <fidl_fuchsia_wlan_common::WlanMacRole as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4207                if inlined != (member_inline_size <= 4) {
4208                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4209                }
4210                let inner_offset;
4211                let mut inner_depth = depth.clone();
4212                if inlined {
4213                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4214                    inner_offset = next_offset;
4215                } else {
4216                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4217                    inner_depth.increment()?;
4218                }
4219                let val_ref = self.role.get_or_insert_with(|| {
4220                    fidl::new_empty!(
4221                        fidl_fuchsia_wlan_common::WlanMacRole,
4222                        fidl::encoding::DefaultFuchsiaResourceDialect
4223                    )
4224                });
4225                fidl::decode!(
4226                    fidl_fuchsia_wlan_common::WlanMacRole,
4227                    fidl::encoding::DefaultFuchsiaResourceDialect,
4228                    val_ref,
4229                    decoder,
4230                    inner_offset,
4231                    inner_depth
4232                )?;
4233                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4234                {
4235                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4236                }
4237                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4238                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4239                }
4240            }
4241
4242            next_offset += envelope_size;
4243            _next_ordinal_to_read += 1;
4244            if next_offset >= end_offset {
4245                return Ok(());
4246            }
4247
4248            // Decode unknown envelopes for gaps in ordinals.
4249            while _next_ordinal_to_read < 2 {
4250                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4251                _next_ordinal_to_read += 1;
4252                next_offset += envelope_size;
4253            }
4254
4255            let next_out_of_line = decoder.next_out_of_line();
4256            let handles_before = decoder.remaining_handles();
4257            if let Some((inlined, num_bytes, num_handles)) =
4258                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4259            {
4260                let member_inline_size = <fidl::encoding::HandleType<
4261                    fidl::Channel,
4262                    { fidl::ObjectType::CHANNEL.into_raw() },
4263                    2147483648,
4264                > as fidl::encoding::TypeMarker>::inline_size(
4265                    decoder.context
4266                );
4267                if inlined != (member_inline_size <= 4) {
4268                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4269                }
4270                let inner_offset;
4271                let mut inner_depth = depth.clone();
4272                if inlined {
4273                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4274                    inner_offset = next_offset;
4275                } else {
4276                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4277                    inner_depth.increment()?;
4278                }
4279                let val_ref =
4280                self.mlme_channel.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
4281                fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
4282                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4283                {
4284                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4285                }
4286                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4287                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4288                }
4289            }
4290
4291            next_offset += envelope_size;
4292            _next_ordinal_to_read += 1;
4293            if next_offset >= end_offset {
4294                return Ok(());
4295            }
4296
4297            // Decode unknown envelopes for gaps in ordinals.
4298            while _next_ordinal_to_read < 3 {
4299                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4300                _next_ordinal_to_read += 1;
4301                next_offset += envelope_size;
4302            }
4303
4304            let next_out_of_line = decoder.next_out_of_line();
4305            let handles_before = decoder.remaining_handles();
4306            if let Some((inlined, num_bytes, num_handles)) =
4307                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4308            {
4309                let member_inline_size =
4310                    <fidl::encoding::Array<u8, 6> as fidl::encoding::TypeMarker>::inline_size(
4311                        decoder.context,
4312                    );
4313                if inlined != (member_inline_size <= 4) {
4314                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4315                }
4316                let inner_offset;
4317                let mut inner_depth = depth.clone();
4318                if inlined {
4319                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4320                    inner_offset = next_offset;
4321                } else {
4322                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4323                    inner_depth.increment()?;
4324                }
4325                let val_ref =
4326                self.init_sta_addr.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Array<u8, 6>, fidl::encoding::DefaultFuchsiaResourceDialect));
4327                fidl::decode!(fidl::encoding::Array<u8, 6>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
4328                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4329                {
4330                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4331                }
4332                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4333                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4334                }
4335            }
4336
4337            next_offset += envelope_size;
4338
4339            // Decode the remaining unknown envelopes.
4340            while next_offset < end_offset {
4341                _next_ordinal_to_read += 1;
4342                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4343                next_offset += envelope_size;
4344            }
4345
4346            Ok(())
4347        }
4348    }
4349
4350    impl WlanPhyInitRequest {
4351        #[inline(always)]
4352        fn max_ordinal_present(&self) -> u64 {
4353            if let Some(_) = self.notify_client {
4354                return 1;
4355            }
4356            0
4357        }
4358    }
4359
4360    impl fidl::encoding::ResourceTypeMarker for WlanPhyInitRequest {
4361        type Borrowed<'a> = &'a mut Self;
4362        fn take_or_borrow<'a>(
4363            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4364        ) -> Self::Borrowed<'a> {
4365            value
4366        }
4367    }
4368
4369    unsafe impl fidl::encoding::TypeMarker for WlanPhyInitRequest {
4370        type Owned = Self;
4371
4372        #[inline(always)]
4373        fn inline_align(_context: fidl::encoding::Context) -> usize {
4374            8
4375        }
4376
4377        #[inline(always)]
4378        fn inline_size(_context: fidl::encoding::Context) -> usize {
4379            16
4380        }
4381    }
4382
4383    unsafe impl
4384        fidl::encoding::Encode<WlanPhyInitRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
4385        for &mut WlanPhyInitRequest
4386    {
4387        unsafe fn encode(
4388            self,
4389            encoder: &mut fidl::encoding::Encoder<
4390                '_,
4391                fidl::encoding::DefaultFuchsiaResourceDialect,
4392            >,
4393            offset: usize,
4394            mut depth: fidl::encoding::Depth,
4395        ) -> fidl::Result<()> {
4396            encoder.debug_check_bounds::<WlanPhyInitRequest>(offset);
4397            // Vector header
4398            let max_ordinal: u64 = self.max_ordinal_present();
4399            encoder.write_num(max_ordinal, offset);
4400            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4401            // Calling encoder.out_of_line_offset(0) is not allowed.
4402            if max_ordinal == 0 {
4403                return Ok(());
4404            }
4405            depth.increment()?;
4406            let envelope_size = 8;
4407            let bytes_len = max_ordinal as usize * envelope_size;
4408            #[allow(unused_variables)]
4409            let offset = encoder.out_of_line_offset(bytes_len);
4410            let mut _prev_end_offset: usize = 0;
4411            if 1 > max_ordinal {
4412                return Ok(());
4413            }
4414
4415            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4416            // are envelope_size bytes.
4417            let cur_offset: usize = (1 - 1) * envelope_size;
4418
4419            // Zero reserved fields.
4420            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4421
4422            // Safety:
4423            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4424            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4425            //   envelope_size bytes, there is always sufficient room.
4426            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<WlanPhyNotifyMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
4427            self.notify_client.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<WlanPhyNotifyMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
4428            encoder, offset + cur_offset, depth
4429        )?;
4430
4431            _prev_end_offset = cur_offset + envelope_size;
4432
4433            Ok(())
4434        }
4435    }
4436
4437    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4438        for WlanPhyInitRequest
4439    {
4440        #[inline(always)]
4441        fn new_empty() -> Self {
4442            Self::default()
4443        }
4444
4445        unsafe fn decode(
4446            &mut self,
4447            decoder: &mut fidl::encoding::Decoder<
4448                '_,
4449                fidl::encoding::DefaultFuchsiaResourceDialect,
4450            >,
4451            offset: usize,
4452            mut depth: fidl::encoding::Depth,
4453        ) -> fidl::Result<()> {
4454            decoder.debug_check_bounds::<Self>(offset);
4455            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4456                None => return Err(fidl::Error::NotNullable),
4457                Some(len) => len,
4458            };
4459            // Calling decoder.out_of_line_offset(0) is not allowed.
4460            if len == 0 {
4461                return Ok(());
4462            };
4463            depth.increment()?;
4464            let envelope_size = 8;
4465            let bytes_len = len * envelope_size;
4466            let offset = decoder.out_of_line_offset(bytes_len)?;
4467            // Decode the envelope for each type.
4468            let mut _next_ordinal_to_read = 0;
4469            let mut next_offset = offset;
4470            let end_offset = offset + bytes_len;
4471            _next_ordinal_to_read += 1;
4472            if next_offset >= end_offset {
4473                return Ok(());
4474            }
4475
4476            // Decode unknown envelopes for gaps in ordinals.
4477            while _next_ordinal_to_read < 1 {
4478                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4479                _next_ordinal_to_read += 1;
4480                next_offset += envelope_size;
4481            }
4482
4483            let next_out_of_line = decoder.next_out_of_line();
4484            let handles_before = decoder.remaining_handles();
4485            if let Some((inlined, num_bytes, num_handles)) =
4486                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4487            {
4488                let member_inline_size = <fidl::encoding::Endpoint<
4489                    fidl::endpoints::ClientEnd<WlanPhyNotifyMarker>,
4490                > as fidl::encoding::TypeMarker>::inline_size(
4491                    decoder.context
4492                );
4493                if inlined != (member_inline_size <= 4) {
4494                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4495                }
4496                let inner_offset;
4497                let mut inner_depth = depth.clone();
4498                if inlined {
4499                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4500                    inner_offset = next_offset;
4501                } else {
4502                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4503                    inner_depth.increment()?;
4504                }
4505                let val_ref = self.notify_client.get_or_insert_with(|| {
4506                    fidl::new_empty!(
4507                        fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<WlanPhyNotifyMarker>>,
4508                        fidl::encoding::DefaultFuchsiaResourceDialect
4509                    )
4510                });
4511                fidl::decode!(
4512                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<WlanPhyNotifyMarker>>,
4513                    fidl::encoding::DefaultFuchsiaResourceDialect,
4514                    val_ref,
4515                    decoder,
4516                    inner_offset,
4517                    inner_depth
4518                )?;
4519                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4520                {
4521                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4522                }
4523                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4524                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4525                }
4526            }
4527
4528            next_offset += envelope_size;
4529
4530            // Decode the remaining unknown envelopes.
4531            while next_offset < end_offset {
4532                _next_ordinal_to_read += 1;
4533                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4534                next_offset += envelope_size;
4535            }
4536
4537            Ok(())
4538        }
4539    }
4540}