# `Modbuv.Codec`
[🔗](https://github.com/ultra0224/modbuv/blob/v0.1.0/lib/modbuv/codec.ex#L1)

Modbus PDU encoding and decoding. A PDU is `<<fc, body::binary>>`; slave/unit
ids, CRC, and MBAP live in the transport layers.

# `code_to_reason`

```elixir
@spec code_to_reason(0..255) :: atom() | {:unknown_exception, integer()}
```

# `pack_exception`

```elixir
@spec pack_exception(integer(), atom()) :: binary()
```

# `pack_request`

```elixir
@spec pack_request(tuple()) :: binary()
```

# `pack_response`

```elixir
@spec pack_response(tuple(), list() | nil) :: binary()
```

# `parse_request`

```elixir
@spec parse_request(0..255, binary(), map()) :: {:ok, tuple()} | {:error, atom()}
```

# `parse_response`

```elixir
@spec parse_response(tuple(), binary()) :: list() | nil | {:error, term()}
```

# `reason_to_code`

```elixir
@spec reason_to_code(atom()) :: 1..11
```

# `response_encodable?`

```elixir
@spec response_encodable?(tuple()) :: boolean()
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
