View Source
Modbux.Tcp
(Modbux v0.3.12)
Tcp message helper, functions that handles TCP responses/requests messages.
@spec parse_req(<<_::48, _::_*8>>) ::
{{:einval | :error | :fc | :phr | :rc | :rhr | :ri | :rir, byte(), char(),
[any()] | char()}, char()}
@spec parse_res(any(), <<_::48, _::_*8>>, char()) ::
nil | [any()] | {:error, any()} | {:error, byte(), <<_::104>>}
@spec req_len({:fc | :phr | :rc | :rhr | :ri | :rir, any(), any(), any()}) ::
integer()
@spec res_len({:fc | :phr | :rc | :rhr | :ri | :rir, any(), any(), any()}) :: number()
@spec unwrap(<<_::48, _::_*8>>) :: {binary(), char()}
@spec unwrap(<<_::48, _::_*8>>, char()) :: nil | binary()