1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//! Provides stream messages that come from a running stream
use super::*;
use crate::config::*;
use crate::daq::Qty;
use crate::siggen::Siggen;
use anyhow::{Result, bail};
use crossbeam::channel::Sender;
use reinterpret::{reinterpret_slice, reinterpret_vec};
use std::any::TypeId;
use std::sync::{Arc, RwLock};
use strum_macros::Display;
/// Status of the pre-capture buffer, always sent together with stream metadata.
#[derive(Clone, Debug)]
pub enum PreCaptureBuffer {
/// Buffer is fully loaded with the last 3 seconds of data.
/// Oldest blocks first.
Loaded(Vec<Arc<InStreamData>>),
/// Stream has not been running long enough to fill 3 seconds of pre-capture data.
NotLoaded,
}
/// Input stream messages, to be send to handlers.
#[derive(Clone, Debug)]
pub enum InStreamMsg {
/// Raw stream data that is coming from a device. This is interleaved data. The number of channels is correct and
/// specified in the stream metadata.
InStreamData(Arc<InStreamData>),
/// An error has occured in the stream
StreamError(StreamError),
/// new Stream metadata enters the scene. Probably a new stream started.
/// Includes the pre-capture buffer status as second argument.
StreamStarted(Arc<StreamMetaData>, PreCaptureBuffer),
/// An existing stream stopped.
StreamStopped,
}