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: StringReflector callsign this stream was captured from (e.g. "REF030").
module: StringModule letter (A-Z) the stream was received on.
protocol: StringProtocol name: "dplus", "dextra", or "dcs".
stream_id: u16D-STAR stream ID (non-zero u16 on wire).
callsign: StringOperator 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: SlowDataAssemblerStateful 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
impl StreamCapture
Sourcepub(crate) fn new(
reflector: String,
module: String,
protocol: String,
stream_id: StreamId,
header: &DStarHeader,
) -> Self
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.
Sourcepub(crate) fn push_frame(&mut self, frame: &VoiceFrame)
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.
Sourcefn consume_slow_data(&mut self, block: SlowDataBlock)
fn consume_slow_data(&mut self, block: SlowDataBlock)
Processes a single assembled slow-data block, updating capture fields.
Text: store the trimmed text message asdstar_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.
Sourcepub(crate) const fn frame_count(&self) -> usize
pub(crate) const fn frame_count(&self) -> usize
Returns the number of voice frames captured so far.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for StreamCapture
impl RefUnwindSafe for StreamCapture
impl Send for StreamCapture
impl Sync for StreamCapture
impl Unpin for StreamCapture
impl UnwindSafe for StreamCapture
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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