Skip to main content

lager/nets/
scope.rs

1//! Oscilloscope / logic-analyzer nets (Rigol MSO5000 family).
2//!
3//! **Not yet available over the box `:9000` HTTP API.** Scope capture and
4//! streaming are large stateful workflows that still run over the legacy
5//! `:5000` Python-exec path and the dedicated oscilloscope daemon. Every
6//! method on this handle returns [`crate::Error::NotSupportedByBox`] until
7//! the box exposes scope actions on `:9000` — see `MISSING_ENDPOINTS.md`
8//! in this crate's repository for the endpoint sketch.
9
10use crate::error::{Error, Result};
11
12const FEATURE: &str = "scope";
13const DETAILS: &str = "the box needs `POST :9000/net/command` scope/logic roles (or a \
14     dedicated capture endpoint) for trigger config, single capture, and \
15     measurement queries; see MISSING_ENDPOINTS.md";
16
17fn unsupported<T>() -> Result<T> {
18    Err(Error::NotSupportedByBox {
19        feature: FEATURE,
20        details: DETAILS,
21    })
22}
23
24/// Handle for an oscilloscope (analog or logic) net. **Stub:** every method
25/// currently returns [`Error::NotSupportedByBox`].
26#[derive(Debug, Clone)]
27pub struct Scope {
28    name: String,
29}
30
31impl Scope {
32    pub(crate) fn new(name: impl Into<String>) -> Self {
33        Scope { name: name.into() }
34    }
35
36    /// Name of the net this handle drives.
37    pub fn name(&self) -> &str {
38        &self.name
39    }
40
41    /// Enable the channel this net maps to.
42    pub fn enable(&self) -> Result<()> {
43        unsupported()
44    }
45
46    /// Disable the channel this net maps to.
47    pub fn disable(&self) -> Result<()> {
48        unsupported()
49    }
50
51    /// Perform a single triggered capture and return the trace.
52    pub fn capture(&self) -> Result<Vec<f64>> {
53        unsupported()
54    }
55
56    /// Query a scalar measurement (e.g. `"vpp"`, `"frequency"`).
57    pub fn measure(&self, _item: &str) -> Result<f64> {
58        unsupported()
59    }
60}