AutoApi.Command.from_bin
You're seeing just the function
from_bin
, go back to AutoApi.Command module for more information.
Specs
Parses a binary command and returns a struct with the command data.
The struct type determines the command action, and further data is contained in the struct fields themselves.
Possible result types are:
- AutoApi.GetAvailabilityCommand
- AutoApi.GetCommand
- AutoApi.SetCommand
See the documentation for each module to understand what their fields stand for.
Examples
iex> Elixir.AutoApi.Command.from_bin(<<0x0D, 0x00, 0x33, 0x02, 0x01, 0x04>>)
%AutoApi.GetAvailabilityCommand{capability: AutoApi.DiagnosticsCapability, properties: [:mileage, :engine_rpm]}
iex> Elixir.AutoApi.Command.from_bin(<<0x0D, 0x00, 0x33, 0x00, 0x01, 0x04>>)
%AutoApi.GetCommand{capability: AutoApi.DiagnosticsCapability, properties: [:mileage, :engine_rpm]}
iex> # Parses a "lock vehicle doors" command
iex> Elixir.AutoApi.Command.from_bin(<<13, 0, 32, 1, 6, 0, 4, 1, 0, 1, 1>>)
%AutoApi.SetCommand{capability: AutoApi.DoorsCapability, state: %AutoApi.DoorsState{locks_state: %AutoApi.Property{data: :locked}}}