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