AutoApi.LightsState (auto_api v13.2.0) View Source

Lights 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
Link to this type

front_exterior_light()

View Source

Specs

front_exterior_light() ::
  :inactive | :active | :active_with_full_beam | :drl | :automatic

Specs

nonce() :: binary()
Link to this type

parking_light_status()

View Source

Specs

parking_light_status() :: :off | :left | :right | :both

Specs

switch_position() ::
  :automatic
  | :dipped_headlights
  | :parking_light_right
  | :parking_light_left
  | :sidelights

Specs

t() :: %AutoApi.LightsState{
  ambient_light_colour: AutoApi.State.property(AutoApi.CustomType.rgb_colour()),
  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
    ),
  emergency_brake_light:
    AutoApi.State.property(AutoApi.CustomType.active_state()),
  fog_lights: AutoApi.State.multiple_property(AutoApi.CustomType.light()),
  front_exterior_light:
    AutoApi.State.property(
      :inactive
      | :active
      | :active_with_full_beam
      | :drl
      | :automatic
    ),
  interior_lights: AutoApi.State.multiple_property(AutoApi.CustomType.light()),
  nonce: AutoApi.State.property(binary()),
  parking_light_status: AutoApi.State.property(:off | :left | :right | :both),
  reading_lamps:
    AutoApi.State.multiple_property(AutoApi.CustomType.reading_lamp()),
  rear_exterior_light:
    AutoApi.State.property(AutoApi.CustomType.active_state()),
  reverse_light: AutoApi.State.property(AutoApi.CustomType.active_state()),
  switch_position:
    AutoApi.State.property(
      :automatic
      | :dipped_headlights
      | :parking_light_right
      | :parking_light_left
      | :sidelights
    ),
  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

from_bin(binary()) :: t()

Build state based on binary value

iex> bin = <<5, 0, 4, 1, 0, 1, 1>> iex> AutoApi.LightsState.from_bin(bin) %AutoApi.LightsState{reverse_light: %AutoApi.Property{data: :active}}

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.LightsState{reverse_light: %AutoApi.Property{data: :active}} iex> AutoApi.LightsState.to_bin(state) <<5, 0, 4, 1, 0, 1, 1>>