1#![cfg_attr(feature = "benchmark", feature(test))]
9pub mod append;
10pub mod bss;
11pub mod buffer_reader;
12pub mod buffer_writer;
13pub mod capabilities;
14pub mod channel;
15pub mod data_writer;
16pub mod energy;
17pub mod error;
18pub mod ie;
19pub mod mac;
20pub mod mgmt_writer;
21pub mod organization;
22pub mod scan;
23pub mod security;
24pub mod sequence;
25pub mod sequestered;
26pub mod sink;
27pub mod stats;
28#[cfg(target_os = "fuchsia")]
29pub mod test_utils;
30pub mod tim;
31pub mod time;
32#[cfg(target_os = "fuchsia")]
33pub mod timer;
34pub mod tx_vector;
35pub mod wmm;
36
37use channel::{Cbw, Channel};
38use zerocopy::{Ref, Unalign};
39use {fidl_fuchsia_wlan_common as fidl_common, fidl_fuchsia_wlan_sme as fidl_sme};
40
41pub use time::TimeUnit;
42
43#[derive(Clone, Debug, PartialEq)]
44pub struct RadioConfig {
45 pub phy: fidl_common::WlanPhyType,
46 pub channel: Channel,
47}
48
49impl From<RadioConfig> for fidl_sme::RadioConfig {
50 fn from(radio_cfg: RadioConfig) -> fidl_sme::RadioConfig {
51 fidl_sme::RadioConfig { phy: radio_cfg.phy, channel: radio_cfg.channel.into() }
52 }
53}
54
55impl TryFrom<fidl_sme::RadioConfig> for RadioConfig {
56 type Error = anyhow::Error;
57 fn try_from(fidl_radio_cfg: fidl_sme::RadioConfig) -> Result<RadioConfig, Self::Error> {
58 Ok(RadioConfig { phy: fidl_radio_cfg.phy, channel: fidl_radio_cfg.channel.try_into()? })
59 }
60}
61
62impl RadioConfig {
63 pub fn new(phy: fidl_common::WlanPhyType, cbw: Cbw, primary_channel: u8) -> Self {
64 RadioConfig { phy, channel: Channel::new(primary_channel, cbw) }
65 }
66}
67
68pub type UnalignedView<B, T> = Ref<B, Unalign<T>>;