Grizzly.ZWave.DSK (grizzly v0.18.2) View Source

Module for working with the SmartStart and S2 DSKs

Link to this section Summary

Types

The DSK binary is the elixir binary string form of the DSK

The DSK string is the string version of the DSK

t()

Functions

Take a binary representation of the DSK and change it into the string representation

Make a new DSK

Parse a textual representation of a DSK

Take a string representation of the DSK and change it into the binary representation

Convert the DSK to a string

Generate a DSK that is all zeros

Link to this section Types

Specs

dsk_binary() :: <<_::128>>

The DSK binary is the elixir binary string form of the DSK

The format is <<b1, b2, b3, ... b16>>

That is 16 bytes.

An example of this would be:

<<196, 109, 73, 131, 38, 196, 119, 227, 62, 101, 131, 175, 15, 165, 14, 39>>

Specs

dsk_string() :: <<_::376>>

The DSK string is the string version of the DSK

The general format is XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX

That is 8 blocks of 16 bit integers separated by a dash.

An example of this would be 50285-18819-09924-30691-15973-33711-04005-03623

Specs

t() :: %Grizzly.ZWave.DSK{raw: <<_::128>>}

Link to this section Functions

Link to this function

binary_to_string(dsk_binary)

View Source

Specs

binary_to_string(dsk_binary()) :: {:ok, dsk_string()}

Take a binary representation of the DSK and change it into the string representation

Specs

new(binary()) :: t()

Make a new DSK

Specs

parse(dsk_string()) :: {:ok, t()} | {:error, :invalid_dsk}

Parse a textual representation of a DSK

Link to this function

string_to_binary(dsk_string)

View Source
This function is deprecated. Use DSK.parse/1 instead.

Specs

string_to_binary(dsk_string()) :: {:ok, dsk_binary()} | {:error, :invalid_dsk}

Take a string representation of the DSK and change it into the binary representation

Link to this function

to_string(dsk, opts \\ [])

View Source

Specs

to_string(t(), keyword()) :: String.t()

Convert the DSK to a string

iex> {:ok, dsk} = DSK.parse("50285-18819-09924-30691-15973-33711-04005-03623")
iex> DSK.to_string(dsk)
"50285-18819-09924-30691-15973-33711-04005-03623"

iex> {:ok, dsk} = DSK.parse("50285-18819-09924-30691-15973-33711-04005-03623")
iex> DSK.to_string(dsk, delimiter: "")
"5028518819099243069115973337110400503623"

Options:

  • :delimiter - character to join the 5 byte sections together (default "-")

Specs

zeros() :: t()

Generate a DSK that is all zeros

This is useful for placeholder/default DSKs.