Expand description
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:
Environment -> RemoteRuntime -> RemoteHost -> RemoteFixture -> RemoteSource -> RemoteEmitterFor 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.
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());
}
}
}§Light Control
Display commands use message::Configuration and message::Flux.
use enody::message::{Configuration, Flux};
fixture
.display(Configuration::Blackbody(4000.0), Flux::Relative(0.5))
.await?;For longer fades, send one transition command and let the device interpolate
locally. The runtime emits TransitionStart(current, transition),
followed by TransitionEnd(transition, final_state) with the original
command context.
Remote fixture/source helpers return the final receiver state after the end
event, which may differ from the target if the transition was interrupted.
Sending a new transition to the same receiver interrupts the old transition;
the new transition starts from the interrupted state while other commands can
continue to receive responses during the animation.
use core::time::Duration;
use enody::message::{
Configuration, FixtureState, Flux, SourceState, Transition, TransitionMethod,
};
fixture
.transition(Transition {
target: FixtureState::new(Configuration::Blackbody(2700.0), Flux::Relative(0.4)),
method: TransitionMethod::Linear(Duration::from_secs(2)),
})
.await?;
source
.transition(Transition {
target: SourceState::new(Configuration::Flux, Flux::Relative(0.0)),
method: TransitionMethod::Linear(Duration::from_millis(750)),
})
.await?;§Feature Flags
remote: host-side discovery and transport APIs. This impliesstd.cli: theenodycommand-line tool and token persistence helpers.std: standard library support for shared types that can also build inno_stdmode.
Default features are remote and cli.
Modules§
- emitter
- Emitter traits and remote emitter handles. Emitter-level control and spectral data access.
- environment
remote - Discovery traits and runtime arrival/removal events. Discovery abstractions for collections of remote runtimes.
- fixture
- Fixture traits and remote fixture handles. Fixture-level traits and remote fixture handles.
- host
- Host traits and remote host handles. Host-level traits and remote host handles.
- message
- Public command, event, topology, setting, network, and token protocol types. Shared command/event protocol and topology wire types.
- runtime
- Local runtime traits and host-side remote command dispatch. Runtime traits and host-side remote command dispatch.
- serialization
- Postcard serialization plus USB STX/ETX/DLE framing helpers. Serialization and USB frame parsing.
- source
- Source traits and remote source handles. Source-level traits and remote source handles.
- spectral
- Spectral sample and spectral data containers. Spectral sample and spectral data structures.
- token_
store cliandstd - Host-side persistence for saved WiFi authentication tokens. Host-side persistence for WiFi authentication tokens.
- update
remote - EP01 firmware update helpers. EP01 firmware update helpers.
- usb
remote - USB discovery and transport backends. USB discovery and transport support.
- wifi
- WiFi wire protocol, discovery, authentication, and pairing helpers. WiFi wire protocol and host-side WiFi discovery/authentication.
Enums§
- Error
- Error type shared by local traits, wire protocol operations, and remote transports.
Type Aliases§
- Debug
Error std - Debug error payload when
stdis available. - Identifier
- Unique identifier used for hosts, fixtures, sources, emitters, commands, and events.
- Measurement
- Floating-point measurement used for flux, chromaticity, wavelength, and spectral values.
- USBError
std - USB error payload when
stdis available.