File dsss_burst_receiver_core.h¶
FileList > doppler > dsss_burst_receiver > dsss_burst_receiver_core.h
Go to the source code of this file
DsssBurstReceiver — the burst chain composed in C. More...
#include "doppler/clib_common.h"#include "doppler/jm_perf.h"#include "doppler/buffer/buffer.h"#include "doppler/dp_state.h"#include "doppler/burst_capture/burst_capture_core.h"#include "doppler/correlator/correlator_core.h"#include "doppler/burst_demod/burst_demod_core.h"#include "doppler/burst_despreader/burst_despreader_core.h"#include "doppler/ppe/ppe_core.h"#include "doppler/fft2d/fft2d_core.h"#include "doppler/spectral/spectral_core.h"#include "doppler/loop_filter/loop_filter_core.h"#include "doppler/detection/detection_core.h"#include "doppler/fft/fft_core.h"#include "doppler/pn/pn_core.h"#include "doppler/conv/conv_core.h"#include "doppler/rs/rs_core.h"#include "doppler/gold/gold_core.h"#include "doppler/mpsk/mpsk_core.h"#include "doppler/cvt/cvt_core.h"#include "doppler/wfm/wfm_frame.h"
Classes¶
| Type | Name |
|---|---|
| struct | dp_dsss_burst_receiver_state_t DsssBurstReceiver state. |
| struct | dsss_br_event_t One completed burst's event, as events() hands it back. |
Public Functions¶
| Type | Name |
|---|---|
| int | dp_dsss_burst_receiver_configure_search_raw (dp_dsss_burst_receiver_state_t * state, size_t doppler_bins, size_t n_noncoh) Pin the acquisition search grid, bypassing the auto-sizing. |
| dp_dsss_burst_receiver_state_t * | dp_dsss_burst_receiver_create_desc (const uint8_t * acq_code, size_t acq_code_len, const uint8_t * data_code, size_t data_code_len, const wfm_frame_desc_t * frame, size_t reps, size_t spc, double chip_rate, double cn0_dbhz, double doppler_uncertainty, double pfa, double pd, double carrier_hz, double max_rate, size_t est_segments, const char ** why) Create a receiver from the frame DESCRIPTION the transmitter spread, and no hand-counted frame length. |
| dp_dsss_burst_receiver_state_t * | dp_dsss_burst_receiver_create_frame (const uint8_t * acq_code, size_t acq_code_len, const uint8_t * data_code, size_t data_code_len, const wfm_frame_desc_t * frame, size_t reps, size_t spc, double chip_rate, double cn0_dbhz, double doppler_uncertainty, double pfa, double pd, double carrier_hz, double max_rate, size_t est_segments) Find each burst by its preamble, capture it and demodulate its frame, all behind one push(). |
| void | dp_dsss_burst_receiver_destroy (dp_dsss_burst_receiver_state_t * state) Destroy a dsss_burst_receiver instance and release all memory. |
| size_t | dp_dsss_burst_receiver_events (dp_dsss_burst_receiver_state_t * state, size_t n, dsss_br_event_t * out, size_t max_out) The event record for each burst the last push() returned. |
| size_t | dp_dsss_burst_receiver_events_max_out (dp_dsss_burst_receiver_state_t * state) Max records events() writes: one per burst the last push() returned. |
| double | dp_dsss_burst_receiver_get_cn0_dbhz_est (const dp_dsss_burst_receiver_state_t * state) Acquisition's C/N0 estimate for the most recent burst. |
| double | dp_dsss_burst_receiver_get_demod_cn0_dbhz (const dp_dsss_burst_receiver_state_t * state) The demodulator's C/N0 for the most recent burst. |
| double | dp_dsss_burst_receiver_get_demod_timing_chips (const dp_dsss_burst_receiver_state_t * state) Burst-start error the demodulator measured, most recent burst. |
| double | dp_dsss_burst_receiver_get_doppler_hz_est (const dp_dsss_burst_receiver_state_t * state) Signed coarse Doppler of the most recent burst, from acquisition. |
| double | dp_dsss_burst_receiver_get_doppler_res_hz (const dp_dsss_burst_receiver_state_t * state) Width of the coarse Doppler estimate (acquisition's bin), Hz. |
| uint64_t | dp_dsss_burst_receiver_get_dropped (const dp_dsss_burst_receiver_state_t * state) Samples of look-back the capture discarded while a queued burst still needed them never refused input, which push() does not do. A LOST BURST, not a statistic a lifetime count that survives reset(). |
| double | dp_dsss_burst_receiver_get_est_freq_hz (const dp_dsss_burst_receiver_state_t * state) The demodulator's residual-frequency estimate, most recent burst. |
| double | dp_dsss_burst_receiver_get_est_rate_hz (const dp_dsss_burst_receiver_state_t * state) The demodulator's Doppler-rate estimate, most recent burst. |
| bool | dp_dsss_burst_receiver_get_frame_valid (const dp_dsss_burst_receiver_state_t * state) Whether the most recent burst's frame passed its CRC. |
| size_t | dp_dsss_burst_receiver_get_min_gap (const dp_dsss_burst_receiver_state_t * state) Dead air a caller must leave BETWEEN bursts, edge to edge. |
| uint64_t | dp_dsss_burst_receiver_get_n_bursts (const dp_dsss_burst_receiver_state_t * state) Bursts demodulated over this receiver's lifetime. |
| size_t | dp_dsss_burst_receiver_get_pending (const dp_dsss_burst_receiver_state_t * state) Detections the capture holds whose burst has not yet completed. |
| uint64_t | dp_dsss_burst_receiver_get_preamble_start (const dp_dsss_burst_receiver_state_t * state) Stream-absolute preamble start of the most recent burst, samples. |
| size_t | dp_dsss_burst_receiver_get_refine_span (const dp_dsss_burst_receiver_state_t * state) Candidate preamble offsets the refine stage searches. |
| size_t | dp_dsss_burst_receiver_get_retain_span (const dp_dsss_burst_receiver_state_t * state) Look-back that must stay reachable: refine span + one burst. |
| void | dp_dsss_burst_receiver_get_state (const dp_dsss_burst_receiver_state_t * state, void * blob) Serialize state's cross-call state intoblob (caller-owned,dp_dsss_burst_receiver_state_bytes() long). |
| size_t | dp_dsss_burst_receiver_llrs (dp_dsss_burst_receiver_state_t * state, size_t n, float * out, size_t max_out) The SOFT bits of every burst the last push() returned. |
| size_t | dp_dsss_burst_receiver_llrs_max_out (dp_dsss_burst_receiver_state_t * state, size_t n) Max LLRs llrs() writes: frame bits x the bursts the last push returned. |
| size_t | dp_dsss_burst_receiver_push (dp_dsss_burst_receiver_state_t * state, const float _Complex * x, size_t x_len, uint8_t * out, size_t max_out) Stream samples; return the payload of EVERY burst that completed. |
| size_t | dp_dsss_burst_receiver_push_max_out (dp_dsss_burst_receiver_state_t * state, size_t x_len) Max bits push() can write for an input of x_len samples. |
| void | dp_dsss_burst_receiver_reset (dp_dsss_burst_receiver_state_t * state) Return to searching: drop the history and clear every read-back. |
| int | dp_dsss_burst_receiver_set_state (dp_dsss_burst_receiver_state_t * state, const void * blob) Restore cross-call state from blob (replacing it). |
| size_t | dp_dsss_burst_receiver_state_bytes (const dp_dsss_burst_receiver_state_t * state) Byte size of state's blob (envelope + payload + child). |
Macros¶
| Type | Name |
|---|---|
| define | DSSS_BURST_RECEIVER_STATE_MAGIC [**DP\_FOURCC**](dp__state_8h.md#define-dp_fourcc)('D', 'B', 'R', 'X')Per-object envelope tag: "DBRX" (DsssBurstReceiver). |
| define | DSSS_BURST_RECEIVER_STATE_VERSION 8uLayout version of the DsssBurstReceiver state blob. 8: the capture's search child is the correlator's search flavor ('CORL', #2752 3.4b). |
Detailed Description¶
Composes the three certified burst objects behind one push(): acquisition SEARCHES the stream, a refine stage recovers the exact preamble start, and the demodulator produces the payload. It owns the hand-off between them the epoch, the fold, and the look-back reaching back to a burst start that has already gone past which is the part every caller previously redid by hand. See docs/design/dsss-burst-receiver.md.
Lifecycle: create, then push() repeatedly, then destroy. There is no step()/steps(): a burst is a frame, not a sample.
uint8_t acq[31] = { 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0,
0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0 };
uint8_t data[8] = { 1, 0, 1, 1, 0, 0, 1, 0 }, sb[13] = { 0 };
const wfm_seq_t sync = { .kind = WFM_SEQ_LITERAL, .bits = sb, .len = 13 };
const wfm_seq_t body = { .kind = WFM_SEQ_DATA, .len = 32 };
wfm_frame_desc_t f;
dp_wfm_frame_fixed (&f, NULL, 0, &sync, &body, 1); // sync|data:32|crc16
dp_dsss_burst_receiver_state_t *rx = dp_dsss_burst_receiver_create_desc (
acq, 31, data, 8, &f, 4, 4, 1.0e6, 55.0, 0.0, 1e-3, 0.9, 0.0, 0.0, 10,
NULL);
if (!rx)
return 1;
float _Complex samples[256] = { 0 }; // the stream goes here
uint8_t bits[(13 + 32 + 16) * 4]; // frame_syms per burst: sync|payload|CRC
size_t n = dp_dsss_burst_receiver_push (rx, samples, 256, bits,
sizeof bits);
(void)n; // the bits are the FRAME as received
dp_dsss_burst_receiver_destroy (rx);
Public Functions Documentation¶
function dp_dsss_burst_receiver_configure_search_raw¶
Pin the acquisition search grid, bypassing the auto-sizing.
int dp_dsss_burst_receiver_configure_search_raw (
dp_dsss_burst_receiver_state_t * state,
size_t doppler_bins,
size_t n_noncoh
)
The escape hatch for a caller who wants a specific (doppler_bins, n_noncoh) rather than the grid the cn0_dbhz/pfa/pd sizing chooses. Forwards to the embedded engine unchanged.
Parameters:
stateMust be non-NULL.doppler_binsCoherent depth to pin, in[1, reps].n_noncohNon-coherent looks to combine.
Returns:
0 on success; DP_ERR_INVALID if the grid is out of range (this receiver's capture or its engine refused it); DP_ERR_MEMORY if the engine's rebuild could not allocate (its prior grid stays).
>>> import numpy as np
>>> from doppler.dsss import DsssBurstReceiver
>>> from doppler.wfm import Frame
>>> rng = np.random.default_rng(0)
>>> desc = Frame(sync=np.zeros(13, np.uint8), payload=np.zeros(3, np.uint8),
... crc="crc16") # 13 + 3 + 16 = 32 symbols a burst
>>> rx = DsssBurstReceiver(
... rng.integers(0, 2, 31).astype(np.uint8),
... rng.integers(0, 2, 8).astype(np.uint8), desc, reps=4, spc=4)
>>> rx.configure_search_raw(doppler_bins=1, n_noncoh=1)
function dp_dsss_burst_receiver_create_desc¶
Create a receiver from the frame DESCRIPTION the transmitter spread, and no hand-counted frame length.
dp_dsss_burst_receiver_state_t * dp_dsss_burst_receiver_create_desc (
const uint8_t * acq_code,
size_t acq_code_len,
const uint8_t * data_code,
size_t data_code_len,
const wfm_frame_desc_t * frame,
size_t reps,
size_t spc,
double chip_rate,
double cn0_dbhz,
double doppler_uncertainty,
double pfa,
double pd,
double carrier_hz,
double max_rate,
size_t est_segments,
const char ** why
)
The sync word is the description's field 0, frame_syms its layout's length (both from dp_wfm_frame_desc_rx), and a frame's verdict is dp_wfm_frame_desc_crc_ok over the description, so a frame with no CRC stage is never valid (decision D3 of docs/design/rx-frame-description.md). The description is copied (without its sequences), so the caller may free it at once. This is the one constructor: acquisition, refine and demodulation composed behind one push(), with the look-back span DERIVED from the geometry rather than asked of the caller.
Parameters:
acq_codepreamble code, 0/1 chips.acq_code_lenits length, chips.data_codepayload spreading code, 0/1 chips.data_code_lenits length, chips.framethe description (const wfm_frame_desc_t *).repspreamble code repetitions.spcsamples per chip.chip_ratechips per second.cn0_dbhzdesign C/N0 for the acquisition, dB-Hz (or NaN).doppler_uncertaintythe Doppler span to search, cycles/sample.pfafalse-alarm probability, in (0, 1).pddetection probability, in (0, 1).carrier_hzthe carrier the baseband is offset by, Hz.max_ratethe Doppler rate expected, cycles/sample^2.est_segmentspartials per acquisition period.whyon a NULL return, a static sentence naming the fix; may beNULL.
Returns:
the receiver, or NULL with why set.
const uint8_t sb[3] = { 1, 0, 1 }, acq[7] = { 1, 1, 1, 0, 1, 0, 0 };
const uint8_t dcode[4] = { 1, 0, 1, 1 };
const wfm_seq_t sync = { .kind = WFM_SEQ_LITERAL, .bits = sb, .len = 3 };
const wfm_seq_t data = { .kind = WFM_SEQ_DATA, .len = 8 };
wfm_frame_desc_t f;
dp_wfm_frame_fixed (&f, NULL, 0, &sync, &data, 1); // sync|data:8|crc16
const char *why = NULL;
dp_dsss_burst_receiver_state_t *rx = dp_dsss_burst_receiver_create_desc (
acq, 7, dcode, 4, &f, 3, 2, 1e6, 60.0, 0.0, 1e-3, 0.9, 0.0, 0.0, 10,
&why);
if (!rx || rx->frame_syms != 3 + 8 + 16)
return 1;
dp_dsss_burst_receiver_destroy (rx);
function dp_dsss_burst_receiver_create_frame¶
Find each burst by its preamble, capture it and demodulate its frame, all behind one push().
dp_dsss_burst_receiver_state_t * dp_dsss_burst_receiver_create_frame (
const uint8_t * acq_code,
size_t acq_code_len,
const uint8_t * data_code,
size_t data_code_len,
const wfm_frame_desc_t * frame,
size_t reps,
size_t spc,
double chip_rate,
double cn0_dbhz,
double doppler_uncertainty,
double pfa,
double pd,
double carrier_hz,
double max_rate,
size_t est_segments
)
Give it the preamble and payload spreading codes and the frame description the transmitter spread (a Frame or FrameDesc): the frame's first field is the sync word the receiver correlates for and its layout is the frame's length, so no length is counted by hand. The description is copied, so it need not outlive the receiver. A description the receiver cannot use raises ValueError naming the rules. C: this is dp_dsss_burst_receiver_create_desc() without its why out-parameter, so a refusal is a NULL return; call the _desc form to be told why.
Parameters:
acq_codepreamble code, 0/1 chips.acq_code_lenits length, chips.data_codepayload spreading code, 0/1 chips.data_code_lenits length, chips.framethe description (const wfm_frame_desc_t *).repspreamble code repetitions.spcsamples per chip.chip_ratechips per second.cn0_dbhzdesign C/N0 for the acquisition, dB-Hz (or NaN).doppler_uncertaintythe Doppler span to search, cycles/sample.pfafalse-alarm probability, in (0, 1).pddetection probability, in (0, 1).carrier_hzthe carrier the baseband is offset by, Hz.max_ratethe Doppler rate expected, cycles/sample^2.est_segmentspartials per acquisition period.
Returns:
the receiver, or NULL.
>>> import numpy as np
>>> from doppler.dsss import DsssBurstReceiver
>>> from doppler.wfm import Frame
>>> rng = np.random.default_rng(0)
>>> acq = rng.integers(0, 2, 31).astype(np.uint8)
>>> dat = rng.integers(0, 2, 8).astype(np.uint8)
>>> desc = Frame(sync=np.zeros(13, np.uint8), payload=np.zeros(3, np.uint8),
... crc="crc16") # the 32-symbol frame the burst carries
>>> rx = DsssBurstReceiver(acq, dat, desc, reps=4, spc=4)
>>> rx.n_bursts
0
function dp_dsss_burst_receiver_destroy¶
Destroy a dsss_burst_receiver instance and release all memory.
Parameters:
stateMay be NULL.
function dp_dsss_burst_receiver_events¶
The event record for each burst the last push() returned.
size_t dp_dsss_burst_receiver_events (
dp_dsss_burst_receiver_state_t * state,
size_t n,
dsss_br_event_t * out,
size_t max_out
)
Row i describes the payload at out[i*frame_syms ...] of that push. A single push can complete many bursts and each needs its own event, so these are a list rather than the scalar read-backs those still exist and still describe the LAST burst, but they cannot speak for the others.
Valid until the next push(), reset() or set_state(). Deliberately not serialized: it describes one call, and keeping it out of the blob is what holds state_bytes() to a pure function of configuration.
Parameters:
stateMust be non-NULL.nIgnored. The record count is whatever the last push() produced, not something a caller chooses; this parameter exists because every variable-output method carries one, and the binding uses it only as a floor on the buffer it allocates.outRecords, caller-owned,max_outlong.max_outCapacity ofout; see events_max_out().
Returns:
Records written to out min(events_max_out(), max_out).
>>> import numpy as np
>>> from doppler.dsss import DsssBurstReceiver
>>> from doppler.wfm import Frame
>>> rng = np.random.default_rng(0)
>>> desc = Frame(sync=np.zeros(13, np.uint8), payload=np.zeros(3, np.uint8),
... crc="crc16") # 13 + 3 + 16 = 32 symbols a burst
>>> rx = DsssBurstReceiver(
... rng.integers(0, 2, 31).astype(np.uint8),
... rng.integers(0, 2, 8).astype(np.uint8), desc, reps=4, spc=4)
>>> bits = rx.push(np.zeros(4096, dtype=np.complex64))
>>> len(rx.events()) == bits.size // 32 # one record per payload
True
function dp_dsss_burst_receiver_events_max_out¶
Max records events() writes: one per burst the last push() returned.
Parameters:
stateMust be non-NULL.
Returns:
The number of bursts the most recent push() completed.
function dp_dsss_burst_receiver_get_cn0_dbhz_est¶
Acquisition's C/N0 estimate for the most recent burst.
Backed out of the detection hit's statistic, so it saturates at the code's autocorrelation-sidelobe floor at high C/N0; not a measurement on the decoded symbols; compare dp_dsss_burst_receiver_get_demod_cn0_dbhz().
Parameters:
stateMust be non-NULL.
Returns:
C/N0, dB-Hz.
function dp_dsss_burst_receiver_get_demod_cn0_dbhz¶
The demodulator's C/N0 for the most recent burst.
Measured on the decoded symbols, referred to the channel and corrected for the sub-chip start error (see the demod_cn0_dbhz field).
Parameters:
stateMust be non-NULL.
Returns:
C/N0, dB-Hz.
function dp_dsss_burst_receiver_get_demod_timing_chips¶
Burst-start error the demodulator measured, most recent burst.
double dp_dsss_burst_receiver_get_demod_timing_chips (
const dp_dsss_burst_receiver_state_t * state
)
Parameters:
stateMust be non-NULL.
Returns:
Signed start error, chips (the sub-sample remainder after whole samples were removed).
function dp_dsss_burst_receiver_get_doppler_hz_est¶
Signed coarse Doppler of the most recent burst, from acquisition.
Parameters:
stateMust be non-NULL.
Returns:
Doppler estimate, Hz.
function dp_dsss_burst_receiver_get_doppler_res_hz¶
Width of the coarse Doppler estimate (acquisition's bin), Hz.
Parameters:
stateMust be non-NULL.
Returns:
Doppler resolution, Hz.
function dp_dsss_burst_receiver_get_dropped¶
Samples of look-back the capture discarded while a queued burst still needed them never refused input, which push() does not do. A LOST BURST, not a statistic a lifetime count that survives reset().
Parameters:
stateMust be non-NULL.
Returns:
Dropped samples, lifetime; forwarded from the embedded capture.
function dp_dsss_burst_receiver_get_est_freq_hz¶
The demodulator's residual-frequency estimate, most recent burst.
Parameters:
stateMust be non-NULL.
Returns:
Residual frequency, Hz.
function dp_dsss_burst_receiver_get_est_rate_hz¶
The demodulator's Doppler-rate estimate, most recent burst.
Parameters:
stateMust be non-NULL.
Returns:
Doppler rate, Hz/s.
function dp_dsss_burst_receiver_get_frame_valid¶
Whether the most recent burst's frame passed its CRC.
Always false for a frame description with no CRC stage. Cleared by reset(); not serialized.
Parameters:
stateMust be non-NULL.
Returns:
true if the last demodulated frame checked.
function dp_dsss_burst_receiver_get_min_gap¶
Dead air a caller must leave BETWEEN bursts, edge to edge.
Derived by the embedded capture from the geometry (see dp_burst_capture_state_t::min_gap); 0 is a real answer.
Parameters:
stateMust be non-NULL.
Returns:
Minimum gap, samples.
function dp_dsss_burst_receiver_get_n_bursts¶
Bursts demodulated over this receiver's lifetime.
Survives reset() (set_state() restores it). Differs from the capture's count of windows emitted by any window the demodulator refused.
Parameters:
stateMust be non-NULL.
Returns:
Lifetime burst count.
function dp_dsss_burst_receiver_get_pending¶
Detections the capture holds whose burst has not yet completed.
A queued burst is emitted by the push() that delivers its last sample plus the trailing context (retain_span).
Parameters:
stateMust be non-NULL.
Returns:
Queued detections, forwarded from the embedded capture.
function dp_dsss_burst_receiver_get_preamble_start¶
Stream-absolute preamble start of the most recent burst, samples.
The scalar read-backs below all describe the LAST burst demodulated; events() has one record per burst of the last push(). Each reads 0 after create and reset().
Parameters:
stateMust be non-NULL.
Returns:
Sample index of the preamble, counted from the first sample pushed since create or reset().
function dp_dsss_burst_receiver_get_refine_span¶
Candidate preamble offsets the refine stage searches.
Bounds start-to-start separation of two bursts the claim rule keeps apart; it is not the gap between them (see get_min_gap()).
Parameters:
stateMust be non-NULL.
Returns:
Refine span, samples.
function dp_dsss_burst_receiver_get_retain_span¶
Look-back that must stay reachable: refine span + one burst.
Also the minimum trailing context: a burst closer than this to the end of what has been pushed is not emitted until more samples arrive.
Parameters:
stateMust be non-NULL.
Returns:
Retain span, samples.
function dp_dsss_burst_receiver_get_state¶
Serialize state's cross-call state intoblob (caller-owned,dp_dsss_burst_receiver_state_bytes() long).
Carries n_bursts and the last burst's read-backs, then the capture's nested blob (look-back, detection queue, acquisition). Not carried: the codes and geometry (create() restores them), the last push's events/LLRs, and frame_valid.
Parameters:
stateMust be non-NULL.blobCaller-owned buffer.
function dp_dsss_burst_receiver_llrs¶
The SOFT bits of every burst the last push() returned.
size_t dp_dsss_burst_receiver_llrs (
dp_dsss_burst_receiver_state_t * state,
size_t n,
float * out,
size_t max_out
)
crealf(sym * derot) IS the log-likelihood ratio up to a scale, and the demodulator used to compute it, slice it to one bit and free it. A hard decision throws away roughly 2 dB of the coding gain a soft-input decoder exists to deliver (mpsk_soft_demap's own docstring), which is what makes a coded burst worth coding.
Concatenated the same way push()'s payloads are, one row of frame_syms per burst: burst i starts at i * frame_syms, in the order events() reports. The convention is mpsk_soft_demap's — positive means bit 0, so L < 0 reproduces exactly the bits push() returned. Spans the WHOLE frame rather than the payload alone, because a code covers what its description says it covers.
Valid until the next push(), reset() or set_state(); deliberately not serialized, for the same reason events() is not: it describes one call.
Parameters:
stateReceiver handle.nIgnored — the count is the last push's, not a request.outReceives the LLRs.max_outCapacity ofout; see llrs_max_out().
Returns:
LLRs written.
>>> import numpy as np
>>> from doppler.dsss import DsssBurstReceiver
>>> from doppler.wfm import Frame
>>> rng = np.random.default_rng(0)
>>> desc = Frame(sync=np.zeros(13, np.uint8), payload=np.zeros(3, np.uint8),
... crc="crc16") # 13 + 3 + 16 = 32 symbols a burst
>>> rx = DsssBurstReceiver(
... rng.integers(0, 2, 31).astype(np.uint8),
... rng.integers(0, 2, 8).astype(np.uint8), desc, reps=4, spc=4)
>>> bits = rx.push(np.zeros(4096, dtype=np.complex64))
>>> len(bits), len(rx.llrs(rx.llrs_max_out(1))) # nothing decoded
(0, 0)
function dp_dsss_burst_receiver_llrs_max_out¶
Max LLRs llrs() writes: frame bits x the bursts the last push returned.
Parameters:
stateReceiver handle.nIgnored, as in llrs().
Returns:
LLRs the last push() produced (bursts * frame_syms); 0 after create, reset() or set_state().
function dp_dsss_burst_receiver_push¶
Stream samples; return the payload of EVERY burst that completed.
size_t dp_dsss_burst_receiver_push (
dp_dsss_burst_receiver_state_t * state,
const float _Complex * x,
size_t x_len,
uint8_t * out,
size_t max_out
)
Retains x in the history ring and feeds the embedded acquisition. When a detection fires, the refine stage correlates the whole preamble to recover the exact preamble start the quantity acquisition structurally cannot report, its code phase being a lag modulo one code period and the burst is demodulated once its last sample has arrived.
EVERY SAMPLE OF x IS CONSUMED, and every burst that completes is returned by the call that completed it. Payloads are concatenated, so burst i occupies out from i*frame_syms, and events() returns the matching record for each. Returning 0 is normal, not an error: it means no burst completed in this call.
This is the contract doppler#1008 broke. push() used to return at most one burst per call AND abandon the rest of its input to do it, so a block carrying several bursts lost all but the first measured at 6/6 decoded with 333-sample blocks against 1/6 with one large one. The history ring is a contiguous window over the stream and is never reset between bursts, so a payload whose tail falls outside one call is completed by a later one.
Parameters:
stateMust be non-NULL.xInput samples (cf32),x_lenlong.x_lenNumber of input samples.outPayload bits, caller-owned,max_outlong.max_outCapacity ofout; see push_max_out().
Returns:
Bits written to out n_bursts_returned * frame_syms.
>>> import numpy as np
>>> from doppler.dsss import DsssBurstReceiver
>>> from doppler.wfm import Frame
>>> rng = np.random.default_rng(0)
>>> desc = Frame(sync=np.zeros(13, np.uint8), payload=np.zeros(3, np.uint8),
... crc="crc16") # 13 + 3 + 16 = 32 symbols a burst
>>> rx = DsssBurstReceiver(
... rng.integers(0, 2, 31).astype(np.uint8),
... rng.integers(0, 2, 8).astype(np.uint8), desc, reps=4, spc=4)
>>> bits = rx.push(np.zeros(4096, dtype=np.complex64))
>>> bits.size # silence carries no burst
0
function dp_dsss_burst_receiver_push_max_out¶
Max bits push() can write for an input of x_len samples.
push() returns EVERY burst it completed, so the bound scales with the input: distinct bursts cannot overlap, so they are at least burst_len apart, and a push of x_len samples can complete at most x_len/burst_len + 1 of them plus every detection already queued from an earlier call, which is q_cap.
Parameters:
stateMust be non-NULL.x_lenNumber of input samples the caller is about to push.
Returns:
(x_len/burst_len + 1 + q_cap) * frame_syms.
function dp_dsss_burst_receiver_reset¶
Return to searching: drop the history and clear every read-back.
Resets the embedded acquisition, discards the retained look-back, and clears all the event fields, so a fresh stream cannot inherit the previous burst's verdict. The lifetime counters (n_bursts, dropped) deliberately survive a reset that zeroed them could hide that this receiver had already lost samples. Construction parameters are untouched.
Parameters:
stateMust be non-NULL.>>> import numpy as np >>> from doppler.dsss import DsssBurstReceiver >>> from doppler.wfm import Frame >>> rng = np.random.default_rng(0) >>> desc = Frame(sync=np.zeros(13, np.uint8), payload=np.zeros(3, np.uint8), ... crc="crc16") # 13 + 3 + 16 = 32 symbols a burst >>> rx = DsssBurstReceiver( ... rng.integers(0, 2, 31).astype(np.uint8), ... rng.integers(0, 2, 8).astype(np.uint8), desc, reps=4, spc=4) >>> _ = rx.push(np.zeros(1024, dtype=np.complex64)) >>> rx.reset()
function dp_dsss_burst_receiver_set_state¶
Restore cross-call state from blob (replacing it).
Clears the last push's events and LLRs, and frame_valid: it is not in the blob, and this instance's last verdict would otherwise sit beside read-backs restored from another stream (doppler#2642). A rejected outer envelope changes nothing, but this object's scalars are written before the capture's child blob is checked, so a rejected child leaves them already restored.
Parameters:
stateMust be non-NULL; built with the same configuration as the blob's source.blobA blob produced by dp_dsss_burst_receiver_get_state().
Returns:
DP_OK, or DP_ERR_INVALID if the envelope or any child rejects.
function dp_dsss_burst_receiver_state_bytes¶
Byte size of state's blob (envelope + payload + child).
A pure function of configuration, so a blob restores into any instance built the same way.
Parameters:
stateMust be non-NULL.
Returns:
Envelope + 2 uint64 + 7 doubles + the capture's blob size.
Macro Definition Documentation¶
define DSSS_BURST_RECEIVER_STATE_MAGIC¶
Per-object envelope tag: "DBRX" (DsssBurstReceiver).
define DSSS_BURST_RECEIVER_STATE_VERSION¶
Layout version of the DsssBurstReceiver state blob. 8: the capture's search child is the correlator's search flavor ('CORL', #2752 3.4b).
The documentation for this class was generated from the following file native/inc/doppler/dsss_burst_receiver/dsss_burst_receiver_core.h