Skip to main content

readout_with

Function readout_with 

Source
pub fn readout_with(
    payload: &[u8],
    options: ParseOptions,
) -> Result<GetListResponse<'_>>
Expand description

The readings of one SML file in one call: every message is parsed (any error is returned) and the first GetListResponse comes back.

Examples found in repository?
examples/decode.rs (line 238)
236fn dzg_suspect(frame: &[u8], options: ParseOptions) -> Dzg {
237    let (Ok(as_sent), Ok(corrected)) =
238        (readout_with(frame, options), readout_with(frame, options.with_dzg_power(true)))
239    else {
240        return Dzg::Unchanged;
241    };
242    let changed = [Obis::POWER, Obis::POWER_L1, Obis::POWER_L2, Obis::POWER_L3]
243        .into_iter()
244        .any(|o| as_sent.quantity(o) != corrected.quantity(o));
245    match (changed, as_sent.direction(StatusWord::Mme)) {
246        (false, _) | (true, Some(Direction::Export)) => Dzg::Unchanged,
247        (true, Some(Direction::Import)) => Dzg::Confirmed,
248        (true, None) => Dzg::Possible,
249    }
250}