Some better imports and positioning of public and private components

This commit is contained in:
Anne de Jong 2024-04-18 19:12:02 +02:00
parent c20094fb3f
commit 52eb0206eb
8 changed files with 30 additions and 41 deletions

View File

@ -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};

View File

@ -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;

View File

@ -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",

View File

@ -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

View File

@ -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)
}

View File

@ -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.

View File

@ -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;

View File

@ -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,
}