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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
//! Platform-independent static resources for IR button mapping.
//!
//! See the platform-specific crate for primary documentation and examples.
use crateIrStatic;
/// Platform-agnostic IR button mapper device contract.
///
/// Platform crates implement this for their concrete `IrMapping` types so shared logic can wait
/// for mapped button presses without depending on platform-specific modules.
///
/// This trait is intended for app-level button enums mapped from `(addr, cmd)` pairs
/// in platform-specific constructors.
///
/// # Example
///
/// ```rust,no_run
/// use device_envoy_core::ir::IrMapping;
///
/// #[derive(Clone, Copy, Debug, Eq, PartialEq)]
/// enum RemoteKeys {
/// Power,
/// Play,
/// Stop,
/// }
///
/// async fn handle_mapped_button_presses(ir_mapping: &impl IrMapping<RemoteKeys>) -> ! {
/// loop {
/// let remote_key = ir_mapping.wait_for_press().await;
/// // Use mapped key in app logic.
/// match remote_key {
/// RemoteKeys::Power => {
/// // Handle power.
/// }
/// RemoteKeys::Play => {
/// // Handle play.
/// }
/// RemoteKeys::Stop => {
/// // Handle stop.
/// }
/// }
/// }
/// }
///
/// # struct DemoIrMapping;
/// # impl IrMapping<RemoteKeys> for DemoIrMapping {
/// # async fn wait_for_press(&self) -> RemoteKeys {
/// # RemoteKeys::Power
/// # }
/// # }
/// # fn main() {
/// # let ir_mapping = DemoIrMapping;
/// # let _future = handle_mapped_button_presses(&ir_mapping);
/// # }
/// ```
/// Static channel resources for IR mapping events.
///
/// Create with `IrMapping::new_static()` from the platform-specific crate.
// Public for cross-crate platform plumbing; hidden from end-user docs.
;