AutoApi.Command.to_bin

You're seeing just the function to_bin, go back to AutoApi.Command module for more information.

Specs

to_bin(t()) :: binary()

Parses a command and returns it in binary format.

This is a convenience function that only delegates to the to_bin/1 function of the command module.

Examples

iex> # Request all properties for race state iex> command = %AutoApi.GetAvailabilityCommand{capability: AutoApi.RaceCapability, properties: []} iex> Elixir.AutoApi.Command.to_bin(command) <<13, 0, 87, 2>>

iex> # Request the door locks state iex> command = %AutoApi.GetCommand{capability: AutoApi.DoorsCapability, properties: [:locks_state]} iex> Elixir.AutoApi.Command.to_bin(command) <<13, 0, 32, 0, 6>>

iex> # Request to honk the horn for 2.5 seconds iex> capability = AutoApi.HonkHornFlashLightsCapability iex> honk_time = %{value: 2.5, unit: :seconds} iex> state = AutoApi.State.put(capability.state().base(), :honk_time, data: honk_time) iex> command = %AutoApi.SetCommand{capability: capability, state: state} iex> Elixir.AutoApi.Command.to_bin(command) <<13, 0, 38, 1, 5, 0, 13, 1, 0, 10, 7, 0, 64, 4, 0, 0, 0, 0, 0, 0>>