npr::rf::TdmaSyncState class final

Tracks NPR TDMA sync/allocation state from received downlink frames and predicts next local uplink slot start.

Public functions

auto allocation_age_us(uint64_t now_us) const -> uint64_t
Returns age of last allocation frame in microseconds, or UINT64_MAX when no allocation exists.
auto allocation_valid(uint64_t now_us) const -> bool
Returns true while allocation age stays inside protocol validity window.
void clear_allocation()
Invalidates current allocation immediately (used when fresh alloc frame no longer contains local client).
void init(const RadioProfile& profile)
Resets scheduler state and binds radio timing profile used by all slot computations.
auto next_slot_start_us(uint64_t now_us, uint64_t* tx_start_us) const -> bool
Computes first future slot start that matches current multiframe filter and stores it into tx_start_us.
void on_downlink_tdma_byte(uint8_t tdma_byte, uint64_t rx_time_us)
Updates TDMA sync epoch from received downlink TDMA header byte sampled at rx_time_us.
auto slot_budget_us() const -> uint32_t
Returns aggregated TX time budget of currently allocated contiguous microslots.
auto sync_age_us(uint64_t now_us) const -> uint64_t
Returns age of last sync marker in microseconds, or UINT64_MAX when no sync exists.
auto sync_valid(uint64_t now_us) const -> bool
Returns true while sync age stays inside protocol validity window.
void update_allocation(uint32_t offset_us, uint8_t slot_count, uint8_t multiframe_period_code, uint8_t multiframe_id, uint64_t rx_time_us)
Applies latest allocation tuple (offset, slot count, multiframe filter) observed at rx_time_us.