Skip to main content

Ft8StreamDecoder

Struct Ft8StreamDecoder 

Source
pub struct Ft8StreamDecoder { /* private fields */ }
Expand description

Accumulates IQ samples at 12 kHz and decodes FT8 or FT4 frames.

Feed samples incrementally with [feed]. When the internal buffer reaches frame_len samples, a decode attempt is triggered automatically and the results are returned. Call [flush] to attempt a decode on whatever is currently buffered (useful at the end of a session or after a gap). Call [clear] to discard the buffer without decoding.

The decoder operates at the FT8/FT4 native sample rate of 12 000 Hz. Callers receiving samples at a higher rate (e.g. 48 kHz) must decimate before feeding.

A single CallsignHashTable is maintained across frames so nonstandard callsigns hashed in earlier frames can be resolved in later ones.

Implementations§

Source§

impl Ft8StreamDecoder

Source

pub fn new_ft8(fs: f32, base_hz: f32, max_hz: f32, max_cand: usize) -> Self

Create a decoder for FT8 frames.

  • fs — sample rate (should be 12 000 Hz)
  • base_hz — lowest tone-0 frequency to search (Hz)
  • max_hz — highest tone-0 frequency to search (Hz)
  • max_cand — maximum sync candidates to score per decode attempt
Source

pub fn new_ft4(fs: f32, base_hz: f32, max_hz: f32, max_cand: usize) -> Self

Create a decoder for FT4 frames.

Source

pub fn feed(&mut self, iq: &[C32]) -> Vec<Ft8DecodeResult>

Feed IQ samples into the accumulation buffer.

If the buffer reaches frame_len samples after appending, a decode attempt is triggered and the results are returned. Otherwise returns an empty Vec.

Source

pub fn flush(&mut self) -> Vec<Ft8DecodeResult>

Attempt a decode on whatever is currently in the buffer.

Useful at a gap edge when the caller knows a frame has ended but the buffer may be shorter than frame_len (e.g. due to signal dropout). Returns decoded results; does NOT clear the buffer.

Source

pub fn clear(&mut self)

Discard all accumulated samples without decoding.

Source

pub fn len(&self) -> usize

Number of accumulated samples.

Source

pub fn is_empty(&self) -> bool

True if no samples have been accumulated.

Source

pub fn view_buf(&self) -> &[C32]

Read-only view of the accumulated IQ buffer.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.