sparkleplug

Functions

pub fn bit_array_to_sparkplug_payload(
  payload_bit_array: BitArray,
) -> Result(Payload, String)

Attempts to convert a bit array representation of a Sparkplug B payload into a Payload type.

Returns an error if the bit array doesn’t hold a valid representation.

pub fn metric_to_json_string(metric: Metric) -> String

Serialise a Metric into a JSON string.

pub fn sparkplug_payload_to_json_string(
  payload: Payload,
) -> String

Serialise a Payload into a JSON string.

pub fn string_to_metric(
  metric_string: String,
) -> Result(Metric, DecodeError)

Attempts to convert a string representation of a Sparkplug B metric into a Metric type.

Returns an error if the string doesn’t hold a valid representation.

pub fn string_to_sparkplug_payload(
  payload_string: String,
) -> Result(Payload, String)

Attempts to convert a string representation of a Sparkplug B payload into a Payload type.

Returns an error if the string doesn’t hold a valid representation.

Search Document