Skip to main content

WirelessNetCtl

Enum WirelessNetCtl 

Source
pub enum WirelessNetCtl<'a, Q> {
    Commissioning(NetworkType),
    Operational(&'a Q),
}
Expand description

A composite wireless network controller that is the SAME concrete type during both the (BLE) commissioning phase and the operational (Thread/Wifi) phase.

This exists purely to avoid building two structurally-different Matter handler chains per device. InteractionModel::handle and every generated cluster handler adaptor are monomorphized over the whole handler-chain tuple type; if the net-ctl slot has a different type per phase, the entire dispatch tree is compiled twice (~tens of KiB of duplicated .text on embedded targets).

By using WirelessNetCtl<Q> in both phases — Commissioning before the operational controller exists, Operational(&Q) afterwards — the chain type is identical across phases and the dispatch tree monomorphizes once.

The Commissioning variant reproduces the behavior of the former NoopWirelessNetCtl: scan errors with InvalidAction, connect only checks the creds match the network type, and every diag returns its default. The Operational variant delegates to the real controller Q.

Q is named identically at every phase via the wireless driver’s associated net-ctl type (see the Thread/Gatt driver traits), so even the commissioning phase — which has no controller value — can still name the type.

Variants§

§

Commissioning(NetworkType)

Commissioning phase: no operational controller yet (BLE only).

§

Operational(&'a Q)

Operational phase: delegate to the real controller.

Trait Implementations§

Source§

impl<Q> DynBase for WirelessNetCtl<'_, Q>

Available on non-crate feature sync-mutex only.
Source§

impl<Q> NetChangeNotif for WirelessNetCtl<'_, Q>
where Q: NetChangeNotif,

Source§

async fn wait_changed(&self)

Wait until a change occurs.
Source§

impl<Q> NetCtl for WirelessNetCtl<'_, Q>
where Q: NetCtl,

Source§

fn net_type(&self) -> NetworkType

Return the network type of the implementation
Source§

fn connect_max_time_seconds(&self) -> u8

Return the maximum time in seconds for connecting to a network Read more
Source§

fn scan_max_time_seconds(&self) -> u8

Return the maximum time in seconds for scanning for networks Read more
Source§

fn supported_wifi_bands<F>(&self, f: F) -> Result<(), Error>
where F: FnMut(WiFiBandEnum) -> Result<(), Error>,

Return the supported WiFi bands for the implementation in the provided closure Read more
Source§

fn supported_thread_features(&self) -> ThreadCapabilitiesBitmap

Return the supported Thread features for the implementation Read more
Source§

fn thread_version(&self) -> u16

Return the Thread version for the implementation Read more
Source§

async fn scan<F>(&self, network: Option<&[u8]>, f: F) -> Result<(), NetCtlError>
where F: FnMut(&NetworkScanInfo<'_>) -> Result<(), Error>,

Scan for networks and call the provided function for each network found Read more
Source§

async fn connect(&self, creds: &WirelessCreds<'_>) -> Result<(), NetCtlError>

Connect to the network with the given credentials Read more
Source§

impl<Q> ThreadDiag for WirelessNetCtl<'_, Q>
where Q: ThreadDiag,

Source§

fn channel(&self) -> Result<Option<u16>, Error>

Source§

fn routing_role(&self) -> Result<Option<RoutingRoleEnum>, Error>

Source§

fn network_name( &self, f: &mut dyn FnMut(Option<&str>) -> Result<(), Error>, ) -> Result<(), Error>

Source§

fn pan_id(&self) -> Result<Option<u16>, Error>

Source§

fn extended_pan_id(&self) -> Result<Option<u64>, Error>

Source§

fn mesh_local_prefix( &self, f: &mut dyn FnMut(Option<&[u8]>) -> Result<(), Error>, ) -> Result<(), Error>

Source§

fn neighbor_table( &self, f: &mut dyn FnMut(&NeighborTable) -> Result<(), Error>, ) -> Result<(), Error>

Source§

fn route_table( &self, f: &mut dyn FnMut(&RouteTable) -> Result<(), Error>, ) -> Result<(), Error>

Source§

fn partition_id(&self) -> Result<Option<u32>, Error>

Source§

fn weighting(&self) -> Result<Option<u16>, Error>

Source§

fn data_version(&self) -> Result<Option<u16>, Error>

Source§

fn stable_data_version(&self) -> Result<Option<u16>, Error>

Source§

fn leader_router_id(&self) -> Result<Option<u8>, Error>

Source§

fn ext_address(&self) -> Result<Option<u64>, Error>

Source§

fn rloc_16(&self) -> Result<Option<u16>, Error>

Source§

fn security_policy(&self) -> Result<Option<SecurityPolicy>, Error>

Source§

fn channel_page0_mask( &self, f: &mut dyn FnMut(Option<&[u8]>) -> Result<(), Error>, ) -> Result<(), Error>

Source§

fn operational_dataset_components( &self, f: &mut dyn FnMut(Option<&OperationalDatasetComponents>) -> Result<(), Error>, ) -> Result<(), Error>

Source§

fn active_network_faults_list( &self, f: &mut dyn FnMut(NetworkFaultEnum) -> Result<(), Error>, ) -> Result<(), Error>

Source§

fn mac_counters( &self, f: &mut dyn FnMut(Option<&MacCounters>) -> Result<(), Error>, ) -> Result<(), Error>

Lend a snapshot of the IEEE 802.15.4 MAC counters (the cluster’s MACCounts feature set) to the provided closure, or call it with None if the backend does not track them - in which case the corresponding attributes read as unsupported. Read more
Source§

impl<Q> WifiDiag for WirelessNetCtl<'_, Q>
where Q: WifiDiag,

Source§

impl<Q> WirelessDiag for WirelessNetCtl<'_, Q>
where Q: WirelessDiag,

Source§

fn connected(&self) -> Result<bool, Error>

Returns true if the device is connected to a wireless network

Auto Trait Implementations§

§

impl<'a, Q> Freeze for WirelessNetCtl<'a, Q>

§

impl<'a, Q> RefUnwindSafe for WirelessNetCtl<'a, Q>
where Q: RefUnwindSafe,

§

impl<'a, Q> Send for WirelessNetCtl<'a, Q>
where Q: Sync,

§

impl<'a, Q> Sync for WirelessNetCtl<'a, Q>
where Q: Sync,

§

impl<'a, Q> Unpin for WirelessNetCtl<'a, Q>

§

impl<'a, Q> UnsafeUnpin for WirelessNetCtl<'a, Q>

§

impl<'a, Q> UnwindSafe for WirelessNetCtl<'a, Q>
where Q: RefUnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, E> Init<T, E> for T

Source§

unsafe fn __init(self, slot: *mut T) -> Result<(), E>

Initializes slot. Read more
Source§

fn chain<F>(self, f: F) -> ChainInit<Self, F, T, E>
where F: FnOnce(&mut T) -> Result<(), E>,

First initializes the value using self then calls the function f with the initialized value. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T, I> IntoFallibleInit<T> for I
where I: Init<T>,

Source§

fn into_fallible<E>(self) -> impl Init<T, E>

Convert the infallible initializer to a fallible one.
Source§

impl<Source, Target> OctetsInto<Target> for Source
where Target: OctetsFrom<Source>,

Source§

type Error = <Target as OctetsFrom<Source>>::Error

Source§

fn try_octets_into( self, ) -> Result<Target, <Source as OctetsInto<Target>>::Error>

Performs the conversion.
Source§

fn octets_into(self) -> Target
where Self::Error: Into<Infallible>,

Performs an infallible conversion.
Source§

impl<T, E> PinInit<T, E> for T

Source§

unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), E>

Initializes slot. Read more
Source§

fn pin_chain<F>(self, f: F) -> ChainPinInit<Self, F, T, E>
where F: FnOnce(Pin<&mut T>) -> Result<(), E>,

First initializes the value using self then calls the function f with the initialized value. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V