Modbux v0.3.9 Modbux.Rtu View Source

RTU message helper, functions that handles RTU responses/requests messages.

Link to this section Summary

Link to this section Functions

Link to this function

pack_req(cmd)

View Source
pack_req(
  {:fc | :phr | :rc | :rhr | :ri | :rir, integer(), integer(),
   maybe_improper_list() | integer()}
) :: <<_::16, _::_*8>>
Link to this function

pack_res(arg)

View Source
pack_res({any(), integer(), integer(), integer()}) :: <<_::16, _::_*8>>
Link to this function

pack_res(cmd, values)

View Source
pack_res(
  <<_::16, _::_*8>>
  | {:fc | :phr | :rc | :rhr | :ri | :rir, integer(), any(),
     maybe_improper_list() | integer()},
  any()
) :: <<_::16, _::_*8>>
Link to this function

parse_req(wraped)

View Source
parse_req(<<_::16, _::_*8>>) ::
  {:einval | :error | :fc | :phr | :rc | :rhr | :ri | :rir, byte(), char(),
   [any()] | char()}
Link to this function

parse_res(cmd, wraped)

View Source
parse_res(any(), <<_::16, _::_*8>>) ::
  nil | [any()] | {:error, any()} | {:error, byte(), <<_::104>>}
Link to this function

req_len(cmd)

View Source
req_len({:fc | :phr | :rc | :rhr | :ri | :rir, any(), any(), any()}) ::
  integer()
Link to this function

res_len(cmd)

View Source
res_len({:fc | :phr | :rc | :rhr | :ri | :rir, any(), any(), any()}) ::
  number()
Link to this function

unwrap(data)

View Source
unwrap(<<_::16, _::_*8>>) :: binary()
Link to this function

wrap(payload)

View Source
wrap(binary()) :: <<_::16, _::_*8>>