AutoApi.Property (auto_api v13.2.0) View Source

Data wrapper for state properties.

The struct contains three fields: data, timestamp and failure.

The data field can be either a scalar or a map, and when set it contains the actual value of the state property.

The timestamp field indicates when the data was last updated, and it is in DateTime format.

The failure is set if there was an error that prevented retrieving the property data.

The availability fields indicates how often the data is updated, and any limitation on how many times the property can receive updates in a specific time frame.

Link to this section Summary

Functions

Converts Property struct to binary format

Converts Property binary to struct

Link to this section Types

Specs

applies_per() :: :app | :vehicle

Specs

availability() :: %{
  update_rate: update_rate(),
  rate_limit: AutoApi.UnitType.frequency(),
  applies_per: applies_per()
}

Specs

failure() :: %{reason: reason(), description: String.t()}

Specs

reason() ::
  :rate_limit
  | :execution_timeout
  | :format_error
  | :unauthorised
  | :unknown
  | :pending
  | :oem_error
  | :privacy_mode_active

Specs

spec() :: map() | list()

Specs

t() :: t(any())

Specs

t(data) :: %AutoApi.Property{
  availability: nil | availability(),
  data: data,
  failure: nil | failure(),
  timestamp: nil | DateTime.t()
}

Specs

update_rate() ::
  :trip_high
  | :trip
  | :trip_start_end
  | :trip_end
  | :unknown
  | :not_available
  | :on_change

Link to this section Functions

Specs

to_bin(t(), spec()) :: binary()

Converts Property struct to binary format

Link to this function

to_struct(binary, specs)

View Source

Specs

to_struct(binary(), spec()) :: t()

Converts Property binary to struct