# `Grizzly.ZWave.Commands.S2MessageEncapsulation`
[🔗](https://github.com/smartrent/grizzly/blob/v9.1.4/lib/grizzly/zwave/commands/s2_message_encapsulation.ex#L1)

Encapsulates a message for transmission using S2.

## Params

* `:seq_number` - must carry an increment of the value carried in the previous
  outgoing message.
* `:extensions` - a list of extensions (SPAN, MGRP, MOS) to include with the command.
* `:encrypted_extensions?` - when set, indicates that the command includes encrypted
  extensions (MPAN). Unlike `extensions?`, this param is required when encoding as
  it is impossible to determine if the encrypted payload contains extensions at that
  point.
* `:encrypted_payload` - includes the encrypted extensions (if any), encrypted command
  payload, and auth tag

## Notes

* Although this module's functions support encoding/decoding the MPAN extension,
  MPAN is an encrypted extension and must be included in the encrypted payload.
  As such, it will be ignored if provided in the `:extensions` param.

# `extension`

```elixir
@type extension() ::
  {:span, &lt;&lt;_::128&gt;&gt;} | {:mgrp, group_id :: byte()} | {:mos, boolean()}
```

# `extension_type`

```elixir
@type extension_type() :: :span | :mpan | :mgrp | :mos
```

# `param`

```elixir
@type param() ::
  {:seq_number, byte()}
  | {:extensions, list()}
  | {:encrypted_extensions?, boolean()}
  | {:encrypted_payload, binary()}
```

# `encode_extensions`

---

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