ModBoss.Mapping (modboss v0.2.0)

Copy Markdown View Source

Struct representing a modbus mapping.

Summary

Functions

Get the Range of addresses for the given ModBoss.Mapping

Returns a map describing the gap between two mappings of the same type.

Guard that checks whether two mappings are of the same type and occupy adjacent addresses.

Types

address()

@type address() :: non_neg_integer()

count()

@type count() :: pos_integer()

name()

@type name() :: atom()

object_type()

@type object_type() :: :holding_register | :input_register | :coil | :discrete_input

t()

@type t() :: %ModBoss.Mapping{
  address_count: count(),
  as: atom() | {module(), atom()},
  encoded_value: integer() | [integer()],
  gap_safe: boolean(),
  mode: :r | :rw | :w,
  name: name(),
  starting_address: address(),
  type: object_type(),
  value: any()
}

Functions

address_range(mapping)

Get the Range of addresses for the given ModBoss.Mapping

gap(a, b)

Returns a map describing the gap between two mappings of the same type.

Returns %{size: integer(), addresses: MapSet.t()} where addresses contains {type, address} pairs for each address in the gap.

is_adjacent(a, b)

(macro)

Guard that checks whether two mappings are of the same type and occupy adjacent addresses.