StreamCapture

Struct StreamCapture 

Source
pub(crate) struct StreamCapture {
Show 13 fields pub(crate) reflector: String, pub(crate) module: String, pub(crate) protocol: String, pub(crate) stream_id: u16, pub(crate) callsign: String, pub(crate) suffix: Option<String>, pub(crate) ur_call: Option<String>, pub(crate) ambe_frames: Vec<[u8; 9]>, slow_data: SlowDataAssembler, pub(crate) dstar_text: Option<String>, pub(crate) dprs_lat: Option<f64>, pub(crate) dprs_lon: Option<f64>, pub(crate) started_at: DateTime<Utc>,
}
Expand description

State for one in-progress voice-stream capture.

Created when a D-STAR VoiceStart event arrives (via Self::new, which extracts header metadata). Frames are added via Self::push_frame as VoiceFrame events arrive. When the stream ends (EOT or timeout), the accumulated state is consumed by the Tier 3 orchestrator to produce an MP3 and persist a database row.

Fields§

§reflector: String

Reflector callsign this stream was captured from (e.g. "REF030").

§module: String

Module letter (A-Z) the stream was received on.

§protocol: String

Protocol name: "dplus", "dextra", or "dcs".

§stream_id: u16

D-STAR stream ID (non-zero u16 on wire).

§callsign: String

Operator callsign (my_call from the header), ASCII-trimmed.

§suffix: Option<String>

Operator suffix (my_suffix from the header), if non-empty after trim.

§ur_call: Option<String>

Destination callsign (ur_call from the header), if non-empty after trim.

§ambe_frames: Vec<[u8; 9]>

AMBE voice frames accumulated in receive order.

Each frame is 9 bytes; 160 PCM samples will be produced per frame by mbelib-rs. The order is load-bearing: the AMBE decoder uses inter-frame delta prediction.

§slow_data: SlowDataAssembler

Stateful slow-data reassembler.

Fed one 3-byte fragment per voice frame via SlowDataAssembler::push. Emits SlowDataBlock values when complete blocks arrive; we consume those immediately to update dstar_text and dprs_lat/dprs_lon.

§dstar_text: Option<String>

Latest slow-data text message decoded from this stream, if any.

§dprs_lat: Option<f64>

DPRS latitude in decimal degrees, if a DPRS sentence was decoded.

§dprs_lon: Option<f64>

DPRS longitude in decimal degrees, if a DPRS sentence was decoded.

§started_at: DateTime<Utc>

When the voice header arrived (UTC wall-clock time).

Implementations§

Source§

impl StreamCapture

Source

pub(crate) fn new( reflector: String, module: String, protocol: String, stream_id: StreamId, header: &DStarHeader, ) -> Self

Creates a new capture from the D-STAR voice header.

Extracts my_call, my_suffix, and ur_call from the header, trimming ASCII whitespace and dropping empty strings. The header’s RPT1/RPT2 fields are not persisted — they are routing metadata and are redundant with the reflector/module arguments.

Source

pub(crate) fn push_frame(&mut self, frame: &VoiceFrame)

Appends one voice frame to the capture.

The 9-byte AMBE payload is stored verbatim for later mbelib-rs decoding. The 3-byte slow-data fragment is fed to the assembler, which may emit a complete SlowDataBlock after enough fragments arrive. Text and GPS blocks are retained (last-write-wins if the transmission contains multiple); other block kinds are ignored.

Source

fn consume_slow_data(&mut self, block: SlowDataBlock)

Processes a single assembled slow-data block, updating capture fields.

  • Text: store the trimmed text message as dstar_text.
  • Gps: parse the DPRS sentence and store lat/lon if valid; DPRS parse failures are non-fatal (real-world slow data often contains malformed GPS payloads from non-GPS-equipped radios).
  • All other variants (HeaderRetx, FastData, Squelch, Unknown): ignored — not part of the streams table.
Source

pub(crate) const fn frame_count(&self) -> usize

Returns the number of voice frames captured so far.

Trait Implementations§

Source§

impl Debug for StreamCapture

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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.

§

impl<T> Instrument for T

§

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

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

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

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

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

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,