use aranet_types::{CurrentReading, DeviceInfo, DeviceType, HistoryRecord};
use crate::error::Result;
use crate::history::{HistoryInfo, HistoryOptions};
use crate::settings::{CalibrationData, MeasurementInterval};
#[allow(async_fn_in_trait)]
pub trait AranetDevice: Send + Sync {
async fn is_connected(&self) -> bool;
async fn connect(&self) -> Result<()> {
Ok(())
}
async fn disconnect(&self) -> Result<()>;
fn name(&self) -> Option<&str>;
fn address(&self) -> &str;
fn device_type(&self) -> Option<DeviceType>;
async fn read_current(&self) -> Result<CurrentReading>;
async fn read_device_info(&self) -> Result<DeviceInfo>;
async fn read_rssi(&self) -> Result<i16>;
async fn read_battery(&self) -> Result<u8>;
async fn get_history_info(&self) -> Result<HistoryInfo>;
async fn download_history(&self) -> Result<Vec<HistoryRecord>>;
async fn download_history_with_options(
&self,
options: HistoryOptions,
) -> Result<Vec<HistoryRecord>>;
async fn get_interval(&self) -> Result<MeasurementInterval>;
async fn set_interval(&self, interval: MeasurementInterval) -> Result<()>;
async fn get_calibration(&self) -> Result<CalibrationData>;
}