Skip to main content
The Lager Rust crate gives embedded developers first-class access to Lager nets. A hardware-in-the-loop (HIL) test suite can live next to your firmware and run with cargo test. No Python is required. The crate is a pure HTTP/JSON client of the Lager Box API. It covers:
  • power supplies, battery simulators, e-loads and solar simulators
  • GPIO, ADC, DAC, thermocouples, watt meters and energy analyzers
  • SPI, I2C, USB hub ports, robot arms, webcams and routers
  • streaming UART
  • the box-level capabilities: its own BLE adapter, WiFi interface, and BluFi ESP32 provisioning
Debug-probe nets (flash / erase / reset / memory reads / RTT) talk to the box’s debug service.
The package publishes on crates.io as lager-net, because the bare lager name is taken by an unrelated crate. The library target is still named lager, so your code reads use lager::LagerBox;. Full API reference lives on docs.rs/lager-net.

Quickstart

Add the crate to your firmware project’s dev-dependencies:
The crate requires Rust 1.75 or newer and builds on edition 2021. Write a test:
Run it:
LagerBox::connect("hostname-or-ip") also works, with an optional host:port or full URL.

Features

Both clients execute the exact same request builders and response parsers, so the two transports cannot drift apart.

Errors

Everything returns lager::Result<T> with a single Error enum:

Requirements

  • A Lager Box with software new enough to serve POST /net/command — check lager.status()?.capabilities.net_command, or run lager update.
  • Rust 1.75+.
Oscilloscope / logic-analyzer workflows are not exposed on the box HTTP API yet, so Scope ships as a documented stub whose methods return Error::NotSupportedByBox. Support lands when the box API does; the endpoint sketch is tracked in the crate’s MISSING_ENDPOINTS.md.

Reference

Getting started

  • Client and Box — constructing LagerBox, discovery, box locks, safety limits
  • Net Types — the index of every handle
  • Errors — every Error variant and when it fires

Firmware and debug

  • Debug Probes — flash, erase, reset, read memory
  • RTT — firmware logs, and driving an RTT console
  • USB DFU — flashing without a debug probe

Power and simulation

Measurement

I/O and communication

Utilities

Guides