pub mod clusters;
pub mod types;
pub mod ezsp;
pub mod znp;
use async_trait::async_trait;
use super::BoxStream;
use super::error::HomeAutoResult;
use super::types::{AttributeValue, HomeAutoEvent};
pub use ezsp::EzspCoordinator;
pub use types::{
IeeeAddr, NwkAddr, ZigbeeAddr, ZigbeeAttrId, ZigbeeClusterId, ZigbeeDevice, ZigbeeDeviceKind,
cluster_id,
};
pub use znp::ZnpCoordinator;
#[async_trait]
pub trait ZigbeeCoordinator: Send + Sync {
async fn start(&self) -> HomeAutoResult<()>;
async fn stop(&self) -> HomeAutoResult<()>;
async fn permit_join(&self, duration_secs: u8) -> HomeAutoResult<()>;
async fn devices(&self) -> HomeAutoResult<Vec<ZigbeeDevice>>;
async fn read_attribute(
&self,
addr: ZigbeeAddr,
cluster: ZigbeeClusterId,
attr: ZigbeeAttrId,
) -> HomeAutoResult<AttributeValue>;
async fn write_attribute(
&self,
addr: ZigbeeAddr,
cluster: ZigbeeClusterId,
attr: ZigbeeAttrId,
value: AttributeValue,
) -> HomeAutoResult<()>;
async fn invoke_command(
&self,
addr: ZigbeeAddr,
cluster: ZigbeeClusterId,
cmd: u8,
payload: &[u8],
) -> HomeAutoResult<()>;
fn events(&self) -> BoxStream<'static, HomeAutoEvent>;
}