#![doc = include_str!("../README.md")]
#![allow(clippy::needless_range_loop)]
pub mod calc;
pub mod controller;
pub mod dispatcher;
pub mod logging;
pub mod math;
pub mod peripheral;
pub mod socket;
pub use controller::{
Controller, RunHandle, Snapshot,
context::{ControllerCtx, LoopMethod, LossOfContactPolicy, Termination},
};
pub use dispatcher::{
ChannelFilter, CsvDispatcher, DecimationDispatcher, Dispatcher, LowPassDispatcher, Overflow,
};
#[cfg(unix)]
pub use socket::unix::UnixSocket;
pub use socket::{
Socket, SocketAddr, SocketId,
thread_channel::ThreadChannelSocket,
udp::{UdpSocket, possible_broadcast_targets},
};
pub use dispatcher::DataFrameDispatcher;
pub use dispatcher::TimescaleDbDispatcher;
pub use peripheral::{HootlDriver, HootlPeripheral, HootlRunHandle, HootlTransport};
pub const SOCKET_BUFFER_LEN: usize = 1522;
#[cfg(feature = "python")]
pub mod python;
#[macro_export]
macro_rules! py_json_methods {
($ty:ident, $trait:path, $( $method:item ),+ $(,)?) => {
#[cfg(feature = "python")]
#[pymethods]
impl $ty {
$(
$method
)+
fn to_json(&self) -> PyResult<String> {
let payload: &dyn $trait = self;
serde_json::to_string(payload)
.map_err(|e| pyo3::exceptions::PyValueError::new_err(e.to_string()))
}
#[staticmethod]
fn from_json(s: &str) -> PyResult<Self> {
serde_json::from_str::<Self>(s)
.map_err(|e| pyo3::exceptions::PyValueError::new_err(e.to_string()))
}
}
};
}