|
| const char * | arq_conn_state_name (arq_conn_state_t s) |
| | Human-readable name for a connection state (for log output).
|
| |
| const char * | arq_dflow_state_name (arq_dflow_state_t s) |
| | Human-readable name for a data-flow state (for log output).
|
| |
| const char * | arq_event_name (arq_event_id_t ev) |
| | Human-readable name for an event (for log output).
|
| |
| void | arq_fsm_set_callbacks (const arq_fsm_callbacks_t *cbs) |
| | Register FSM action callbacks (call once before first dispatch).
|
| |
| void | arq_fsm_set_timing (arq_timing_ctx_t *timing) |
| | Register timing context for recording (call once at init).
|
| |
| void | arq_fsm_init (arq_session_t *sess) |
| | Initialise a session structure to DISCONNECTED state.
|
| |
| int | arq_fsm_timeout_ms (const arq_session_t *sess, uint64_t now) |
| | Return milliseconds until the next deadline, or INT_MAX if idle.
|
| |
| static void | sess_enter (arq_session_t *sess, arq_conn_state_t new_state, uint64_t deadline_ms, arq_event_id_t deadline_event) |
| |
| static void | dflow_enter (arq_session_t *sess, arq_dflow_state_t new_state, uint64_t deadline_ms, arq_event_id_t deadline_event) |
| |
| static void | send_frame (int ptype, int mode, size_t len, const uint8_t *frame) |
| |
| static uint64_t | deadline_from_s (float seconds) |
| |
| static void | update_local_snr (arq_session_t *sess, const arq_event_t *ev) |
| | Update local_snr_x10 EMA from the SNR carried in a received frame event.
|
| |
| static void | update_peer_snr (arq_session_t *sess, const arq_event_t *ev) |
| | Update peer_snr_x10 from the sender's SNR feedback carried in a received frame.
|
| |
| static void | send_mode_negotiation (arq_session_t *sess, arq_subtype_t subtype, int mode) |
| | Build and send a MODE_REQ or MODE_ACK control frame.
|
| |
| static int | mode_rank (int mode) |
| | Map a FreeDV payload mode to a comparable rank: higher rank = faster/more aggressive mode.
|
| |
| static void | record_tx_outcome (arq_session_t *sess, bool clean) |
| | Record the outcome of a TX frame.
|
| |
| static int | select_best_mode (const arq_session_t *sess, int backlog) |
| | Compute desired payload mode based on peer_snr_x10 and TX backlog.
|
| |
| static bool | maybe_upgrade_mode (arq_session_t *sess) |
| | Check whether a mode upgrade/downgrade is warranted.
|
| |
| static bool | deliver_rx_checked (arq_session_t *sess, const arq_event_t *ev) |
| | Deliver RX payload to the application only if the sequence number matches what we expect.
|
| |
| static void | send_call_accept (arq_session_t *sess, bool is_accept) |
| |
| static void | send_ctrl_frame (arq_session_t *sess, arq_subtype_t subtype) |
| |
| static void | send_ack (arq_session_t *sess, uint8_t ack_delay_raw) |
| |
| static void | send_data_frame (arq_session_t *sess) |
| |
| static void | fsm_dflow (arq_session_t *sess, const arq_event_t *ev) |
| |
| static void | enter_idle_iss (arq_session_t *sess, bool gained_turn) |
| |
| static void | enter_idle_iss_guarded (arq_session_t *sess, bool gained_turn) |
| |
| static void | enter_idle_irs (arq_session_t *sess) |
| |
| static void | fsm_disconnected (arq_session_t *sess, const arq_event_t *ev) |
| |
| static void | fsm_listening (arq_session_t *sess, const arq_event_t *ev) |
| |
| static void | fsm_calling (arq_session_t *sess, const arq_event_t *ev) |
| |
| static void | fsm_accepting (arq_session_t *sess, const arq_event_t *ev) |
| |
| static void | fsm_disconnecting (arq_session_t *sess, const arq_event_t *ev) |
| |
| static void | fsm_connected (arq_session_t *sess, const arq_event_t *ev) |
| |
| void | arq_fsm_dispatch (arq_session_t *sess, const arq_event_t *ev) |
| | Dispatch an event through both FSM levels.
|
| |
| static int select_best_mode |
( |
const arq_session_t * |
sess, |
|
|
int |
backlog |
|
) |
| |
|
static |
Compute desired payload mode based on peer_snr_x10 and TX backlog.
Returns current payload_mode if no change is warranted.
Hybrid SNR + delivery-feedback mode selection. Upgrades require SNR above the mode threshold plus a hysteresis margin. Downgrades happen when SNR drops below the current mode's base threshold, OR when consecutive retries indicate the channel can't support the current mode (catches deep fades where SNR is stale). After a retry-forced downgrade, a hold timer prevents re-upgrade oscillation.