npr::rf::detail namespace

Small helpers that translate NPR runtime link state into pool-source publication events.

These helpers intentionally stay separate from NprRuntime so their decision logic can be tested without full PHY or FreeRTOS setup.

Classes

struct PoolSourcePublishState
Tracks what source snapshot revision has already been published to the pool sink.

Functions

auto build_netif_config_from_runtime_snapshot(const NprNetworkConfig& cfg, prf::net::Ipv4NetifConfig*const netif_cfg) -> bool
auto clear_netif_config(prf::net::Ipv4NetifConfig*const netif_cfg) -> bool
auto finalize_pool_source_after_phy_iteration(prf::net::pool::IPoolSourceSink*const sink, const bool phy_ready, const IMacEngine*const mac_engine, PoolSourcePublishState*const state) -> bool
Synchronizes pool source state after one PHY iteration and tells runtime whether the current worker cycle can continue into MAC/TX processing.
void sync_pool_source_snapshot(prf::net::pool::IPoolSourceSink* sink, bool phy_ready, bool snapshot_valid, const NprNetworkConfig& network_config, PoolSourcePublishState* state)
Synchronizes one NPR-side network snapshot into the pool source sink.
void sync_pool_source_snapshot_from_runtime(prf::net::pool::IPoolSourceSink*const sink, const bool phy_ready, const IMacEngine*const mac_engine, PoolSourcePublishState*const state)
Applies runtime-visible PHY/MAC state to pool source publication.

Function documentation

bool npr::rf::detail::clear_netif_config(prf::net::Ipv4NetifConfig*const netif_cfg)

bool npr::rf::detail::finalize_pool_source_after_phy_iteration(prf::net::pool::IPoolSourceSink*const sink, const bool phy_ready, const IMacEngine*const mac_engine, PoolSourcePublishState*const state)

Synchronizes pool source state after one PHY iteration and tells runtime whether the current worker cycle can continue into MAC/TX processing.

Returns true when the caller may continue with the rest of the worker cycle.

This is the runtime-facing helper used by NprRuntime::radio_worker() to make the !phy_ready -> clear source -> stop worker cycle edge explicit.

void npr::rf::detail::sync_pool_source_snapshot(prf::net::pool::IPoolSourceSink* sink, bool phy_ready, bool snapshot_valid, const NprNetworkConfig& network_config, PoolSourcePublishState* state)

Synchronizes one NPR-side network snapshot into the pool source sink.

Parameters
sink Pool source sink to notify.
phy_ready true when PHY/radio path is currently usable.
snapshot_valid true when network_config contains an up-to-date snapshot.
network_config Current NPR network configuration.
state Mutable publication state cache.

The helper publishes only when phy_ready and snapshot_valid are both true. Otherwise it clears a previously published source.

Example:

npr::rf::detail::PoolSourcePublishState state{};
npr::rf::NprNetworkConfig cfg{};
cfg.valid = true;
cfg.revision = 3u;
npr::rf::detail::sync_pool_source_snapshot(sink, true, true, cfg, &state);

void npr::rf::detail::sync_pool_source_snapshot_from_runtime(prf::net::pool::IPoolSourceSink*const sink, const bool phy_ready, const IMacEngine*const mac_engine, PoolSourcePublishState*const state)

Applies runtime-visible PHY/MAC state to pool source publication.

Parameters
sink Pool source sink owned by network/runtime integration.
phy_ready true when current worker iteration has usable PHY state.
mac_engine Active MAC engine used to fetch current snapshot.
state Mutable publication state cache.

This keeps the runtime edge explicit and testable: PHY readiness gates the source snapshot before MAC-owned network configuration is consulted.