|
Mercury Modem
Mercury ARQ/Broadcast modem
|
#include <stdbool.h>#include <stddef.h>#include <stdint.h>#include "arq.h"#include "arq_timing.h"#include "arq_protocol.h"#include "carousel.h"

Go to the source code of this file.
Data Structures | |
| struct | arq_event_t |
| ARQ event with all possible payload fields. More... | |
| struct | arq_session_t |
| struct | arq_fsm_callbacks_t |
Enumerations | |
| enum | arq_conn_state_t { ARQ_CONN_DISCONNECTED = 0 , ARQ_CONN_LISTENING = 1 , ARQ_CONN_CALLING = 2 , ARQ_CONN_ACCEPTING = 3 , ARQ_CONN_CONNECTED = 4 , ARQ_CONN_DISCONNECTING = 5 , ARQ_CONN__COUNT } |
| enum | arq_event_id_t { ARQ_EV_APP_LISTEN = 0 , ARQ_EV_APP_STOP_LISTEN , ARQ_EV_APP_CONNECT , ARQ_EV_APP_DISCONNECT , ARQ_EV_APP_DATA_READY , ARQ_EV_RX_CALL , ARQ_EV_RX_ACCEPT , ARQ_EV_RX_DISCONNECT , ARQ_EV_TIMER_RETRY , ARQ_EV_TIMER_ACK , ARQ_EV_TX_STARTED , ARQ_EV_TX_COMPLETE , ARQ_EV_RX_CAROUSEL , ARQ_EV_TIMER_CAROUSEL , ARQ_EV_RX_PATTERN , ARQ_EV__COUNT } |
Functions | |
| 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. | |
| void | arq_fsm_release (arq_session_t *sess) |
| void | arq_fsm_dispatch (arq_session_t *sess, const arq_event_t *event) |
| Dispatch an event through both FSM levels. | |
| int | arq_fsm_timeout_ms (const arq_session_t *sess, uint64_t now) |
| Return milliseconds until the next deadline, or INT_MAX if idle. | |
| int | arq_call_carrier (const arq_session_t *sess) |
| The carrier the next CALL goes out on: the control mode for the first ARQ_CALL_FAST_SLOTS, then MFSK and the control mode alternately. | |
| bool | arq_fsm_expect_pattern (const arq_session_t *sess, uint64_t now) |
| Whether a pattern can arrive now (the modem's detector runs only then). | |
| const char * | arq_conn_state_name (arq_conn_state_t s) |
| Human-readable name for a connection state (for log output). | |
| const char * | arq_event_name (arq_event_id_t ev) |
| Human-readable name for an event (for log output). | |
| enum arq_conn_state_t |
| enum arq_event_id_t |
| int arq_call_carrier | ( | const arq_session_t * | sess | ) |
The carrier the next CALL goes out on: the control mode for the first ARQ_CALL_FAST_SLOTS, then MFSK and the control mode alternately.
| const char * arq_conn_state_name | ( | arq_conn_state_t | s | ) |
Human-readable name for a connection 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_dispatch | ( | arq_session_t * | sess, |
| const arq_event_t * | event | ||
| ) |
Dispatch an event through both FSM levels.
Runs transition logic, calls action callbacks, and updates deadlines. Must be called from the single ARQ event-loop thread (no locking inside).
| sess | Active session. |
| event | Event to process. |
| bool arq_fsm_expect_pattern | ( | const arq_session_t * | sess, |
| uint64_t | now | ||
| ) |
Whether a pattern can arrive now (the modem's detector runs only then).
| void arq_fsm_init | ( | arq_session_t * | sess | ) |
Initialise a session structure to DISCONNECTED state.
| sess | Session to initialise. |
| void arq_fsm_release | ( | arq_session_t * | sess | ) |
| 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).
| timing | Pointer to the arq_timing_ctx_t to record into. |
| int arq_fsm_timeout_ms | ( | const arq_session_t * | sess, |
| uint64_t | now | ||
| ) |
Return milliseconds until the next deadline, or INT_MAX if idle.
Used by the event loop's blocking wait to set a poll timeout.
| sess | Active session. |
| now | Current monotonic time in milliseconds. |