AutoApi.CrashState (auto_api v13.2.0) View Source
Keeps Crash state
Link to this section Summary
Functions
Callback implementation for AutoApi.State.base/0.
Build state based on binary value
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
impact_zone() :: :pedestrian_protection | :rollover | :rear_passenger_side | :rear_driver_side | :side_passenger_side | :side_driver_side | :front_passenger_side | :front_driver_side
Specs
nonce() :: binary()
Specs
severity() :: integer()
Specs
status() :: :normal | :restraints_engaged | :airbag_triggered
Specs
t() :: %AutoApi.CrashState{
automatic_ecall: AutoApi.State.property(AutoApi.CustomType.enabled_state()),
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
),
impact_zone:
AutoApi.State.multiple_property(
:pedestrian_protection
| :rollover
| :rear_passenger_side
| :rear_driver_side
| :side_passenger_side
| :side_driver_side
| :front_passenger_side
| :front_driver_side
),
incidents:
AutoApi.State.multiple_property(AutoApi.CustomType.crash_incident()),
nonce: AutoApi.State.property(binary()),
severity: AutoApi.State.property(integer()),
status:
AutoApi.State.property(:normal | :restraints_engaged | :airbag_triggered),
timestamp: AutoApi.State.property(DateTime.t()),
tipped_state: AutoApi.State.property(:tipped_over | :not_tipped),
type: AutoApi.State.property(:pedestrian | :non_pedestrian),
vehicle_signature: AutoApi.State.property(binary()),
vin: AutoApi.State.property(String.t())
}
Specs
timestamp() :: DateTime.t()
Specs
tipped_state() :: :tipped_over | :not_tipped
Specs
type() :: :pedestrian | :non_pedestrian
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 = <<5, 0, 4, 1, 0, 1, 3>> iex> AutoApi.CrashState.from_bin(bin) %AutoApi.CrashState{severity: %AutoApi.Property{data: 3}}
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.CrashState{tipped_state: %AutoApi.Property{data: :not_tipped}} iex> AutoApi.CrashState.to_bin(state) <<3, 0, 4, 1, 0, 1, 1>>