DSMR (DSMR v0.2.1) View Source

A library for parsing Dutch Smart Meter Requirements (DSMR) telegram data.

Link to this section Summary

Functions

Parses telegram data from a string and returns a struct.

Parses telegram data from a string and raises if the data cannot be parsed.

Link to this section Functions

Specs

parse(String.t()) :: {:ok, DSMR.Telegram.t()} | {:error, DSMR.ParseError.t()}

Parses telegram data from a string and returns a struct.

If the telegram is parsed successfully, this function returns {:ok, telegram} where telegram is a DSMR.Telegram struct. If the parsing fails, this function returns {:error, parse_error} where parse_error is a DSMR.ParseError struct. You can use raise/1 with that struct or Exception.message/1 to turn it into a string.

Specs

parse!(String.t()) :: DSMR.Telegram.t()

Parses telegram data from a string and raises if the data cannot be parsed.

This function behaves exactly like parse/1, but returns the telegram directly if parsed successfully or raises a DSMR.ParseError exception otherwise.