use crate::Error;
#[cfg(feature = "api-fingerprint-matcher")]
pub mod matcher;
#[cfg(feature = "api-fingerprint-sensor")]
pub mod sensor;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Debug, PartialEq, Eq)]
pub enum Event {
#[cfg(feature = "api-fingerprint-matcher")]
Matcher(matcher::Event),
#[cfg(feature = "api-fingerprint-sensor")]
Sensor(sensor::Event),
FingerDetected,
}
impl<B: crate::Api> From<Event> for crate::Event<B> {
fn from(event: Event) -> Self {
crate::Event::Fingerprint(event)
}
}
pub trait Api: Send {
#[cfg(feature = "api-fingerprint-matcher")]
type Matcher: matcher::Api;
#[cfg(feature = "api-fingerprint-sensor")]
type Sensor: sensor::Api;
fn enable() -> Result<(), Error>;
fn disable() -> Result<(), Error>;
}
#[cfg(feature = "api-fingerprint-matcher")]
pub type Matcher<B> = <super::Fingerprint<B> as Api>::Matcher;
#[cfg(feature = "api-fingerprint-sensor")]
pub type Sensor<B> = <super::Fingerprint<B> as Api>::Sensor;