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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
//! Rust SDK for discovering, configuring, and controlling Enody lighting products.
//!
//! The crate is split between a host-side remote SDK and a smaller `no_std`
//! protocol/trait surface. With default features enabled, applications can
//! discover devices over USB or WiFi, connect to a `runtime::remote::RemoteRuntime`,
//! and traverse the product hierarchy:
//!
//! ```text
//! Environment -> RemoteRuntime -> RemoteHost -> RemoteFixture -> RemoteSource -> RemoteEmitter
//! ```
//!
//! For embedded or constrained integrations, disable default features to keep
//! the shared message protocol, local traits, spectral data structures, and
//! WiFi wire frames available without `std`.
//!
//! # Discovery
//!
//! USB and WiFi discovery are exposed through `environment::Environment`.
//! Remote traversal is count-then-index based: hosts contain fixtures, fixtures
//! contain sources, and sources contain emitters.
//!
//! ```no_run
//! # #[cfg(feature = "remote")]
//! # async fn example() -> Result<(), enody::Error> {
//! use enody::{environment::Environment, usb::UsbEnvironment};
//!
//! let environment = UsbEnvironment::new();
//! for runtime in environment.runtimes() {
//! let host = runtime.host().await?;
//! for fixture in host.fixtures().await? {
//! for source in fixture.sources().await? {
//! let emitters = source.emitters().await?;
//! println!("source {} has {} emitters", source.identifier(), emitters.len());
//! }
//! }
//! }
//! # Ok(())
//! # }
//! ```
//!
//! # Light Control
//!
//! Display commands use [`message::Configuration`] and [`message::Flux`].
//!
//! ```no_run
//! # #[cfg(feature = "remote")]
//! # async fn example(fixture: enody::fixture::remote::RemoteFixture) -> Result<(), enody::Error> {
//! use enody::message::{Configuration, Flux};
//!
//! fixture
//! .display(Configuration::Blackbody(4000.0), Flux::Relative(0.5))
//! .await?;
//! # Ok(())
//! # }
//! ```
//!
//! # Feature Flags
//!
//! - `remote`: host-side discovery and transport APIs. This implies `std`.
//! - `cli`: the `enody` command-line tool and token persistence helpers.
//! - `std`: standard library support for shared types that can also build in
//! `no_std` mode.
//!
//! Default features are `remote` and `cli`.
extern crate alloc;
/// Emitter traits and remote emitter handles.
/// Discovery traits and runtime arrival/removal events.
/// Fixture traits and remote fixture handles.
/// Host traits and remote host handles.
/// Public command, event, topology, setting, network, and token protocol types.
/// Local runtime traits and host-side remote command dispatch.
/// Postcard serialization plus USB STX/ETX/DLE framing helpers.
/// Source traits and remote source handles.
/// Spectral sample and spectral data containers.
/// Host-side persistence for saved WiFi authentication tokens.
/// EP01 firmware update helpers.
/// USB discovery and transport backends.
/// WiFi wire protocol, discovery, authentication, and pairing helpers.
/// Unique identifier used for hosts, fixtures, sources, emitters, commands, and events.
pub type Identifier = Uuid;
/// Floating-point measurement used for flux, chromaticity, wavelength, and spectral values.
pub type Measurement = f32;
/// Debug error payload when `std` is available.
pub type DebugError = String;
/// Fixed-capacity debug error payload used in `no_std` builds.
pub type DebugError = String;
/// USB error payload when `std` is available.
pub type USBError = String;
/// USB error payload used in `no_std` builds where USB transports are absent.
pub type USBError = ;
/// Error type shared by local traits, wire protocol operations, and remote transports.