Skip to main content

FrameParser

Struct FrameParser 

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

Frame parser. One per channel.

Implementations§

Source§

impl FrameParser

Source

pub fn new(channel_idx: u8, channel_freq_hz: f64) -> Self

Create a parser stamping the given channel index + freq onto every emitted message.

Source

pub fn take_polarity_flip(&mut self) -> bool

Polarity-flip handshake. ChannelBank reads + clears this after each MskDemod::process round; if true, it calls MskDemod::toggle_polarity() to recover from 180° phase slip detected via the inverted-SYN preamble.

Source

pub fn drain<F: FnMut(AcarsMessage)>(&mut self, on_message: F)

Drain decoded messages buffered by synchronous BitSink::put_bitconsume_byte runs. Production callers (ChannelBank::process) invoke this after each demod block. Tests use feed_bytes() instead.

Source

pub fn feed_bytes<F: FnMut(AcarsMessage)>( &mut self, bytes: &[u8], on_message: F, )

Convenience: drive the parser with a sequence of fully- formed bytes — used by unit tests that bypass MSK demod and feed hand-crafted byte sequences directly. Also drains the resulting messages into on_message for test ergonomics.

Trait Implementations§

Source§

impl BitSink for FrameParser

Source§

fn take_polarity_flip(&mut self) -> bool

Polled by MskDemod::process after each put_bit. Returning true tells the demodulator to toggle its internal polarity (acarsdec MskS ^= 2) immediately. ACARS uses this to recover from 180° phase slip detected via inverted-SYN preamble — the C does the toggle directly inside decodeAcars (called from putbit), which means the very next bit emerges from the demod with inverted polarity. Sinks that don’t track polarity (synthetic-test capturers, etc.) keep the default false. Default is non-breaking for existing test stubs.
Source§

fn put_bit(&mut self, value: f32)

One bit per call. value > 0.0 is a binary 1, <= 0.0 is a binary 0 (acarsdec convention — see msk.c::putbit).

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more