Grizzly.ZWave.CommandClasses (grizzly v9.1.0)

Copy Markdown View Source

Utilities for encoding and decoding command classes and command class lists.

Summary

Functions

Turn the binary representation that is outlined in the Network-Protocol specs

Turn the list of command classes into the binary representation outlined in the Network-Protocol command class specification.

Merges command class lists in a way that's more resilient to some Z/IP Gateway bugs. The list provided in the second argument is merged into the first.

Get the byte representation of the command class

Types

command_class()

@type command_class() :: atom()

command_class_list()

@type command_class_list() :: [
  non_secure_supported: [atom()],
  non_secure_controlled: [atom()],
  secure_supported: [atom()],
  secure_controlled: [atom()]
]

Functions

command_class_list_from_binary(binary)

@spec command_class_list_from_binary(binary()) :: [command_class_list()]

Turn the binary representation that is outlined in the Network-Protocol specs

command_class_list_to_binary(command_class_list)

@spec command_class_list_to_binary([command_class_list()]) :: binary()

Turn the list of command classes into the binary representation outlined in the Network-Protocol command class specification.

TODO: add more details

from_byte(byte)

@spec from_byte(byte()) ::
  {:ok, command_class()} | {:error, :unsupported_command_class}

merge(list1, list2)

Merges command class lists in a way that's more resilient to some Z/IP Gateway bugs. The list provided in the second argument is merged into the first.

In particular, there's a Z/IP Gateway bug where it can lose track of a node's supported command classes. If this happens while the node is failing, a Node Info Cached Report can come back with an empty command class list. If requesting the NIF works but the controller doesn't receive an S0/S2 Commands Supported Report (e.g. due to interference), the secure command class lists will be empty.

to_byte(command_class)

@spec to_byte(command_class()) :: byte()

Get the byte representation of the command class

valid?(command_class)

@spec valid?(command_class()) :: boolean()