AutoApi.VehicleStatusState (auto_api v13.2.0) View Source
VehicleStatus 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.
Add a state entry to the provided VehicleStatus state.
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
nonce() :: binary()
Specs
t() :: %AutoApi.VehicleStatusState{ 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 ), nonce: AutoApi.State.property(binary()), states: AutoApi.State.multiple_property(AutoApi.CustomType.capability_state()), 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 = <<153, 0, 14, 1, 0, 11, 13, 0, 103, 1, 1, 0, 4, 1, 0, 1, 2>> iex> state = AutoApi.VehicleStatusState.from_bin(bin) iex> [%AutoApi.Property{data: hood_command}] = state.states iex> %AutoApi.SetCommand{state: hood_state} = hood_command iex> hood_state %AutoApi.HoodState{position: %AutoApi.Property{data: :intermediate}}
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
put_state(t(), AutoApi.State.t()) :: t()
Add a state entry to the provided VehicleStatus state.
This is intended as a convenience wrapper on AutoApi.State.put
that wraps the provided state into a SetCommand.
This is because VehicleStatus.states entries makes only sense as a SetCommand (as they contain the states data).
Example
iex> empty_vs_state = AutoApi.VehicleStatusState.base()
iex> state = %AutoApi.HoodState{position: %AutoApi.Property{data: :open}}
iex> vs_state = AutoApi.VehicleStatusState.put_state(empty_vs_state, state)
iex> %{states: [%AutoApi.Property{data: hood_command}]} = vs_state
iex> %AutoApi.SetCommand{capability: AutoApi.HoodCapability, state: hood_state} = hood_command
iex> hood_state
%AutoApi.HoodState{position: %AutoApi.Property{data: :open}}
Specs
Parse state to bin
iex> hood_state = %AutoApi.HoodState{position: %AutoApi.Property{data: :intermediate}} iex> hood_command = AutoApi.SetCommand.new(AutoApi.HoodCapability, hood_state) iex> state = %AutoApi.VehicleStatusState{states: [%AutoApi.Property{data: hood_command}]} iex> AutoApi.VehicleStatusState.to_bin(state) <<153, 0, 14, 1, 0, 11, 13, 0, 103, 1, 1, 0, 4, 1, 0, 1, 2>>