diff --git a/src/daq/api/api_cpal.rs b/src/daq/api/api_cpal.rs index 9b84767..dcdb44b 100644 --- a/src/daq/api/api_cpal.rs +++ b/src/daq/api/api_cpal.rs @@ -1,5 +1,7 @@ #![allow(dead_code)] use super::Stream; +use super::StreamMetaData; +use crate::daq::streamdata::*; use crate::config::{self, *}; use crate::daq::{self, *}; use anyhow::{bail, Result}; diff --git a/src/daq/api/mod.rs b/src/daq/api/mod.rs index 5a0290d..f481d7f 100644 --- a/src/daq/api/mod.rs +++ b/src/daq/api/mod.rs @@ -7,7 +7,7 @@ use strum::EnumMessage; use strum_macros; use std::sync::Arc; -use super::{streamstatus::StreamStatus, StreamMetaData}; +use super::{streamstatus::StreamStatus, streamdata::StreamMetaData}; #[cfg(feature = "cpal-api")] pub mod api_cpal; diff --git a/src/daq/mod.rs b/src/daq/mod.rs index 4b07d5b..c33d8c6 100644 --- a/src/daq/mod.rs +++ b/src/daq/mod.rs @@ -16,16 +16,15 @@ mod streammgr; mod streammsg; mod streamstatus; -pub use daqconfig::*; +// Module re-exports +pub use daqconfig::{DaqChannel, DaqConfig}; pub use datatype::*; -pub use deviceinfo::*; -pub use qty::*; -pub use streamcmd::*; -pub use streamdata::*; -pub use streamhandler::*; -pub use streammgr::*; -pub use streammsg::*; -pub use streamstatus::*; +pub use deviceinfo::DeviceInfo; +pub use qty::Qty; +pub use streamhandler::StreamHandler; +pub use streammgr::StreamMgr; +pub use streammsg::InStreamMsg; +pub use streamstatus::StreamStatus; #[cfg(feature = "record")] pub use record::*; @@ -61,7 +60,7 @@ pub enum StreamError { detailed_message = "Input buffer overrun" )] InputOverrunError, - + /// Output underrun #[strum( message = "OutputUnderrunError", diff --git a/src/daq/record.rs b/src/daq/record.rs index 4dafc6c..4067c39 100644 --- a/src/daq/record.rs +++ b/src/daq/record.rs @@ -1,14 +1,11 @@ use super::*; use crate::config::Flt; use anyhow::{bail, Error, Result}; -use clap::builder::OsStr; use crossbeam::atomic::AtomicCell; use hdf5::types::{VarLenArray, VarLenUnicode}; use hdf5::{dataset, datatype, Dataset, File, H5Type}; use ndarray::ArrayView2; -use num::traits::ops::mul_add; -use rayon::iter::Empty; -use serde::de::IntoDeserializer; +use clap::builder::OsStr; use std::path::{Path, PathBuf}; use std::str::FromStr; use std::sync::atomic::{AtomicBool, Ordering::SeqCst}; @@ -16,6 +13,9 @@ use std::sync::{Arc, Mutex}; use std::thread::{spawn, JoinHandle}; use std::time::Duration; use strum::EnumMessage; +use streammgr::*; +use streammsg::InStreamMsg; +use streamdata::*; #[derive(Clone, Debug)] /// Status of a recording diff --git a/src/daq/streamcmd.rs b/src/daq/streamcmd.rs index b36bedb..74dfbb1 100644 --- a/src/daq/streamcmd.rs +++ b/src/daq/streamcmd.rs @@ -1,13 +1,5 @@ -//! Provides stream messages that come from a running stream -use crate::config::*; -use crate::daq::Qty; -use crate::siggen::{Siggen, Source}; -use anyhow::{bail, Result}; -use crossbeam::channel::Sender; -use std::any::TypeId; -use std::sync::{Arc, RwLock}; - -use super::*; +use crate::siggen::*; +use super::streammgr::SharedInQueue; cfg_if::cfg_if! { if #[cfg(feature = "python-bindings")] { use pyo3::exceptions::PyValueError; @@ -15,17 +7,21 @@ if #[cfg(feature = "python-bindings")] { use pyo3::{pymodule, pyclass, types::PyModule, PyResult}; } else {} } + /// Commands that can be sent to a running stream pub enum StreamCommand { - /// Add a new queue to a running stream + /// Add a new queue to a running INPUT stream AddInQueue(SharedInQueue), - /// Remove a queue to a running stream + /// Remove a queue to a running INPUT stream RemoveInQueue(SharedInQueue), - /// New signal generator config to be used + /// New signal generator config to be used in OUTPUT stream NewSiggen(Siggen), /// Stop the thread, do not listen for data anymore. StopThread, + + // New signal generator source + // NewSiggenSource(Source) } diff --git a/src/daq/streamhandler.rs b/src/daq/streamhandler.rs index cf3fd58..49326e1 100644 --- a/src/daq/streamhandler.rs +++ b/src/daq/streamhandler.rs @@ -1,6 +1,7 @@ use crossbeam::channel::{unbounded, Receiver}; use super::*; +use streammsg::InStreamMsg; /// A stream handler registers a queue in the stream manager, and keeps the other end to /// get InStreamData from a running input stream. diff --git a/src/daq/streammgr.rs b/src/daq/streammgr.rs index 6805e82..5ce9fe6 100644 --- a/src/daq/streammgr.rs +++ b/src/daq/streammgr.rs @@ -5,6 +5,9 @@ use crate::{ config::*, siggen::{self, Siggen}, }; +use streamcmd::StreamCommand; +use streammsg::*; +use streamdata::*; use anyhow::{bail, Error, Result}; use array_init::from_iter; use core::time; diff --git a/src/daq/streammsg.rs b/src/daq/streammsg.rs index f393509..9cc6058 100644 --- a/src/daq/streammsg.rs +++ b/src/daq/streammsg.rs @@ -3,6 +3,7 @@ use crate::config::*; use crate::daq::Qty; use crate::siggen::Siggen; use anyhow::{bail, Result}; +use streamdata::*; use crossbeam::channel::Sender; use reinterpret::{reinterpret_slice, reinterpret_vec}; use std::any::TypeId; @@ -33,16 +34,3 @@ pub enum InStreamMsg { StreamStopped, } - -/// Stream types that can be started -/// -#[cfg_attr(feature = "python-bindings", pyclass)] -#[derive(PartialEq, Clone, Copy)] -pub enum StreamType { - /// Input-only stream - Input, - /// Output-only stream - Output, - /// Input and output at the same time - Duplex, -}