1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//! A device abstraction support module for RFID readers.
//!
//! See [`Rfid`] for the trait-based API, and use platform crates
//! (`device_envoy-rp` or `device_envoy-esp`) for hardware-specific constructors/examples.
/// Events received from an RFID reader.
/// Platform-agnostic RFID reader contract.
///
/// Platform crates implement this for concrete `Rfid` types so shared logic can
/// await card-tap events without depending on platform-specific modules.
///
/// # Example
///
/// ```rust,no_run
/// use device_envoy_core::rfid::{Rfid, RfidEvent};
///
/// async fn log_card_taps(rfid: &impl Rfid) -> ! {
/// loop {
/// let RfidEvent::CardDetected { uid } = rfid.wait_for_tap().await;
/// let _ = uid;
/// }
/// }
///
/// # struct DemoRfid;
/// # impl Rfid for DemoRfid {
/// # async fn wait_for_tap(&self) -> RfidEvent {
/// # RfidEvent::CardDetected { uid: [0; 10] }
/// # }
/// # }
/// # fn main() {
/// # let rfid = DemoRfid;
/// # let _future = log_card_taps(&rfid);
/// # }
/// ```