Lookup table for sendable Z-Wave commands.
Summary
Functions
Get the handler spec for the command
Look up the command module and handler options for a given command, either by name or from its binary representation.
Look up the command module and handler options for a given command class byte and command byte.
Get the command spec for a given command name.
Get the command spec for a given command class byte and command byte.
Whether the command can be supervised (only commands that use the AckResponse handler can be supervised).
Functions
@spec create( atom(), keyword() ) :: {:error, :unknown_command} | {:ok, Grizzly.ZWave.Command.t()}
@spec create!( atom(), keyword() ) :: Grizzly.ZWave.Command.t()
@spec decode(binary()) :: {:ok, Grizzly.ZWave.Command.t()} | {:error, Grizzly.ZWave.DecodeError.t() | Grizzly.ZWave.ZWaveError.t()}
@spec format_handler_spec(module() | Grizzly.handler_spec()) :: Grizzly.handler_spec()
@spec handler(Grizzly.command()) :: Grizzly.handler_spec()
Get the handler spec for the command
@spec lookup(Grizzly.command() | binary()) :: {module(), [Grizzly.command_opt()]}
Look up the command module and handler options for a given command, either by name or from its binary representation.
@spec lookup(byte(), byte()) :: {module(), [Grizzly.command_opt()]}
Look up the command module and handler options for a given command class byte and command byte.
@spec spec_for(Grizzly.command()) :: {:ok, Grizzly.ZWave.CommandSpec.t()} | {:error, :unknown_command}
Get the command spec for a given command name.
Examples
iex> Grizzly.ZWave.Commands.spec_for(:user_set)
{:ok, %Grizzly.ZWave.CommandSpec{
name: :user_set,
command_byte: 0x05,
command_class: :user_credential,
default_params: [],
module: Grizzly.ZWave.Commands.UserSet,
encode_fun: {Grizzly.ZWave.Commands.UserSet, :encode_params},
decode_fun: {Grizzly.ZWave.Commands.UserSet, :decode_params},
handler: {Grizzly.Requests.Handlers.AckResponse, []},
supports_supervision?: true
}}
@spec spec_for(byte(), byte()) :: {:ok, Grizzly.ZWave.CommandSpec.t()} | {:error, :unknown_command}
Get the command spec for a given command class byte and command byte.
@spec spec_for!(Grizzly.command()) :: Grizzly.ZWave.CommandSpec.t()
See spec_for/1.
@spec spec_for!(byte(), byte()) :: Grizzly.ZWave.CommandSpec.t()
See spec_for/2.
@spec supports_supervision?(Grizzly.command()) :: boolean()
Whether the command can be supervised (only commands that use the AckResponse handler can be supervised).