AutoApi.TachographState (auto_api v13.2.0) View Source

Keeps Tachograph 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

nonce() :: binary()

Specs

t() :: %AutoApi.TachographState{
  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
    ),
  drivers_cards_present:
    AutoApi.State.multiple_property(AutoApi.CustomType.driver_card_present()),
  drivers_time_states:
    AutoApi.State.multiple_property(AutoApi.CustomType.driver_time_state()),
  drivers_working_states:
    AutoApi.State.multiple_property(AutoApi.CustomType.driver_working_state()),
  nonce: AutoApi.State.property(binary()),
  timestamp: AutoApi.State.property(DateTime.t()),
  vehicle_direction: AutoApi.State.property(:forward | :reverse),
  vehicle_motion: AutoApi.State.property(AutoApi.CustomType.detected()),
  vehicle_overspeed: AutoApi.State.property(:no_overspeed | :overspeed),
  vehicle_signature: AutoApi.State.property(binary()),
  vehicle_speed: AutoApi.State.property(AutoApi.UnitType.speed()),
  vin: AutoApi.State.property(String.t())
}

Specs

timestamp() :: DateTime.t()

Specs

vehicle_direction() :: :forward | :reverse

Specs

vehicle_overspeed() :: :no_overspeed | :overspeed

Specs

vehicle_signature() :: binary()

Specs

vin() :: String.t()

Link to this section Functions

Specs

base() :: t()

Callback implementation for AutoApi.State.base/0.

Specs

from_bin(binary()) :: t()

Build state based on binary value

iex> bin = <<4, 0, 4, 1, 0, 1, 1>> iex> AutoApi.TachographState.from_bin(bin) %AutoApi.TachographState{vehicle_motion: %AutoApi.Property{data: :detected}}

Link to this function

put(state, property, property_component_or_params)

View Source

Specs

put(struct(), atom(), AutoApi.Property.t() | keyword() | map()) :: struct()

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

to_bin(t()) :: binary()

Parse state to bin

iex> state = %AutoApi.TachographState{vehicle_motion: %AutoApi.Property{data: :detected}} iex> AutoApi.TachographState.to_bin(state) <<4, 0, 4, 1, 0, 1, 1>>