AutoApi.FailureMessageState (auto_api v13.2.0) View Source
Keeps Failure Message state
Link to this section Summary
Functions
Callback implementation for AutoApi.State.base/0
.
Build state based on binary value
Creates a failure state based on a command
Convenience function to build the State properties.
Parse state to bin
Link to this section Types
Specs
brand() :: :unknown | :abarth | :alfaromeo | :alpine | :audi | :bmw | :cadillac | :chevrolet | :chrysler | :citroen | :cupra | :dacia | :dodge | :ds | :fiat | :ford | :honda | :hyundai | :iveco | :jaguar | :jeep | :kia | :lancia | :land_rover | :lexus | :man | :mazda | :mercedes_benz | :mini | :mitsubishi | :nissan | :opel | :peugeot | :porsche | :renault | :seat | :skoda | :smart | :subaru | :toyota | :volkswagen | :volvo_cars | :emulator
Specs
failed_message_id() :: integer()
Specs
failed_message_type() :: integer()
Specs
failed_property_ids() :: binary()
Specs
failure_description() :: String.t()
Specs
failure_reason() :: :unsupported_capability | :unauthorised | :incorrect_state | :execution_timeout | :vehicle_asleep | :invalid_command | :pending | :rate_limit | :oem_error | :privacy_mode_active
Specs
nonce() :: binary()
Specs
t() :: %AutoApi.FailureMessageState{ brand: AutoApi.State.property( :unknown | :abarth | :alfaromeo | :alpine | :audi | :bmw | :cadillac | :chevrolet | :chrysler | :citroen | :cupra | :dacia | :dodge | :ds | :fiat | :ford | :honda | :hyundai | :iveco | :jaguar | :jeep | :kia | :lancia | :land_rover | :lexus | :man | :mazda | :mercedes_benz | :mini | :mitsubishi | :nissan | :opel | :peugeot | :porsche | :renault | :seat | :skoda | :smart | :subaru | :toyota | :volkswagen | :volvo_cars | :emulator ), failed_message_id: AutoApi.State.property(integer()), failed_message_type: AutoApi.State.property(integer()), failed_property_ids: AutoApi.State.property(binary()), failure_description: AutoApi.State.property(String.t()), failure_reason: AutoApi.State.property( :unsupported_capability | :unauthorised | :incorrect_state | :execution_timeout | :vehicle_asleep | :invalid_command | :pending | :rate_limit | :oem_error | :privacy_mode_active ), nonce: AutoApi.State.property(binary()), timestamp: AutoApi.State.property(DateTime.t()), vehicle_signature: AutoApi.State.property(binary()), vin: AutoApi.State.property(String.t()) }
Specs
timestamp() :: DateTime.t()
Specs
vehicle_signature() :: binary()
Specs
vin() :: String.t()
Link to this section Functions
Specs
base() :: t()
Callback implementation for AutoApi.State.base/0
.
Specs
Build state based on binary value
iex> bin = <<4, 0, 21, 1, 0, 18, 115, 111, 109, 101, 116, 104, 105, 110, 103, 32, 104, 97, 112, 112, 101, 110, 101, 100>> iex> AutoApi.FailureMessageState.from_bin(bin) %AutoApi.FailureMessageState{failure_description: %AutoApi.Property{data: "something happened"}}
Specs
from_command(AutoApi.Command.t(), failure_reason(), String.t()) :: t()
Creates a failure state based on a command
Example
iex> command = AutoApi.GetCommand.new(AutoApi.RaceCapability, [])
iex> Elixir.AutoApi.FailureMessageState.from_command(command, :oem_error, "Vehicle is not available")
%Elixir.AutoApi.FailureMessageState{
failed_message_id: %AutoApi.Property{data: 87},
failed_message_type: %AutoApi.Property{data: 0},
failure_reason: %AutoApi.Property{data: :oem_error},
failure_description: %AutoApi.Property{data: "Vehicle is not available"}
}
Specs
Convenience function to build the State properties.
See AutoApi.State.put/3
.
Examples
iex> state_base = AutoApi.DiagnosticsState.base()
iex> odometer = %{value: 10_921, unit: :kilometers}
iex> state_1 = AutoApi.DiagnosticsState.put(state_base, :odometer, data: odometer)
iex> state_2 = AutoApi.State.put(state_base, :odometer, data: odometer)
iex> state_1 === state_2
true
Specs
Parse state to bin
iex> state = %AutoApi.FailureMessageState{failure_description: %AutoApi.Property{data: "something happened"}} iex> AutoApi.FailureMessageState.to_bin(state) <<4, 0, 21, 1, 0, 18, 115, 111, 109, 101, 116, 104, 105, 110, 103, 32, 104, 97, 112, 112, 101, 110, 101, 100>>