use async_trait::async_trait;
use chrono::*;
mod types;
pub use types::device;
pub use types::Error;
pub type Result<T> = std::result::Result<T, Error>;
#[async_trait]
pub trait Store {
async fn register_read_only_device(
&mut self,
driver: &str,
name: &types::device::Name,
units: &Option<String>,
max_history: &Option<usize>,
) -> Result<(
driver::ReportReading<types::device::Value>,
Option<types::device::Value>,
)>;
async fn register_read_write_device(
&mut self,
driver: &str,
name: &types::device::Name,
units: &Option<String>,
max_history: &Option<usize>,
) -> Result<(
driver::ReportReading<types::device::Value>,
driver::RxDeviceSetting,
Option<types::device::Value>,
)>;
async fn get_device_info(
&mut self,
pattern: &Option<String>,
) -> Result<Vec<client::DevInfoReply>>;
async fn set_device(
&self,
name: types::device::Name,
value: types::device::Value,
) -> Result<types::device::Value>;
async fn get_setting_chan(
&self,
name: types::device::Name,
own: bool,
) -> Result<driver::TxDeviceSetting>;
async fn monitor_device(
&mut self,
name: types::device::Name,
start: Option<DateTime<Utc>>,
end: Option<DateTime<Utc>>,
) -> Result<types::device::DataStream<types::device::Reading>>;
}
pub mod client;
pub mod driver;