npr::rf::SlaveConnectionFsm class final

Slave connection finite-state machine for signaling CONNECT lifecycle.

Public types

enum class State: uint8_t { Trying = 1, Connected = 2, Rejected = 3, Disconnecting = 4 }
High-level connection states observed by MAC planner.

Public functions

auto client_id() const -> uint8_t
Current local client id.
auto connected() const -> bool
true when connected and client id is assigned.
auto disconnecting() const -> bool
true when explicit disconnect handshake is in progress.
auto last_ack_age_us(uint64_t now_us) const -> uint64_t
Age of last ACK sample (or UINT64_MAX-equivalent behavior in implementation).
auto last_reject_reason() const -> uint8_t
Last reject reason code received from master.
void mark_connect_req_sent(uint64_t now_us)
Marks CONNECT_REQ as sent to enforce request cadence.
void mark_disconnect_req_sent(uint64_t now_us)
Marks DISCONNECT_REQ as sent to enforce request cadence.
void on_connect_ack(uint8_t assigned_client_id, uint64_t now_us)
Handles accepted CONNECT_ACK.
void on_connect_nack(uint8_t reason, uint64_t now_us)
Handles CONNECT_NACK and applies reason-specific retry backoff.
void on_disconnect_ack(uint64_t now_us)
Handles accepted DISCONNECT_ACK.
void on_disconnect_request(uint64_t now_us)
Handles master-initiated disconnect request and drops back to discovery.
void periodic(uint64_t now_us)
Performs time-based maintenance transitions.
void request_disconnect(uint64_t now_us)
Starts explicit disconnect handshake from connected state.
void reset(uint64_t now_us)
Resets FSM to discovery/trying state.
auto should_send_connect_req(uint64_t now_us) const -> bool
Returns whether CONNECT_REQ should be transmitted at now_us.
auto should_send_disconnect_req(uint64_t now_us) const -> bool
Returns whether DISCONNECT_REQ should be transmitted at now_us.
auto state() const -> State
Current FSM state.