auto_api v0.1.0 AutoApi.DiagnosticsState View Source
Keeps Diagnostics state
engine_oil_temperature: Engine oil temperature in Celsius, whereas can be negative
Link to this section Summary
Functions
Diagnostics state
Callback implementation for AutoApi.State.base/0
Build state based on binary value
Parse state to bin
Link to this section Types
position() :: :front_left | :front_right | :rear_right | :rear_left
t() :: %AutoApi.DiagnosticsState{adblue_level: float(), average_fuel_consumption: float(), battery_voltage: float(), current_fuel_consumption: float(), distance_since_reset: integer(), distance_since_start: integer(), engine_oil_temperature: integer(), engine_rpm: integer(), estimated_range: integer(), fuel_level: integer(), mileage: integer(), speed: integer(), tire: [tire_data()], washer_fluid_level: fluid_level()}
Link to this section Functions
Diagnostics state
Callback implementation for AutoApi.State.base/0
.
Build state based on binary value
iex> AutoApi.DiagnosticsState.from_bin(<<0x01, 2::integer-16, 100::integer-16>>) %AutoApi.DiagnosticsState{mileage: 100} iex> AutoApi.DiagnosticsState.from_bin(<<0x01, 2::integer-16, 100::integer-16, 0x09, 1::integer-16, 0x01>>) %AutoApi.DiagnosticsState{mileage: 100, washer_fluid_level: :filled}
iex> AutoApi.DiagnosticsState.from_bin(<<0xA, 13::integer-16, 0x03, 4.0::float-32, 8.0::float-32, 169330::integer-32>>) %AutoApi.DiagnosticsState{tire: [%{tire_position: :rear_left, tire_pressure: 4.0, tire_temperature: 8.0, wheel_rpm: 169330}]}
Parse state to bin
iex> AutoApi.DiagnosticsState.to_bin(%AutoApi.DiagnosticsState{engine_oil_temperature: 20,engine_rpm: 70, fuel_level: 99, mileage: 2000, speed: 100, washer_fluid_level: :low, tire: []}) <<12, 0, 4, 0, 0, 0, 0, 8, 0, 4, 0, 0, 0, 0, 11, 0, 4, 0, 0, 0, 0, 7, 0, 4, 0, 0, 0, 0, 13, 0, 2, 0, 0, 14, 0, 2, 0, 0, 2, 0, 2, 0, 20, 4, 0, 2, 0, 70, 6, 0, 2, 0, 0, 5, 0, 1, 99, 1, 0, 2, 7, 208, 3, 0, 2, 0, 100, 9, 0, 1, 0>>
iex> tiers = [%{tire_position: :front_left, tire_pressure: 250.00, tire_temperature: 20.00, wheel_rpm: 2900}] iex> AutoApi.DiagnosticsState.to_bin(%AutoApi.DiagnosticsState{tire: tiers}) <<12, 0, 4, 0, 0, 0, 0, 8, 0, 4, 0, 0, 0, 0, 11, 0, 4, 0, 0, 0, 0, 7, 0, 4, 0, 0, 0, 0, 13, 0, 2, 0, 0, 14, 0, 2, 0, 0, 2, 0, 2, 0, 0, 4, 0, 2, 0, 0, 6, 0, 2, 0, 0, 5, 0, 1, 0, 1, 0, 2, 0, 0, 3, 0, 2, 0, 0, 10, 0, 13, 0, 67, 122, 0, 0, 65, 160, 0, 0, 0, 0, 11, 84, 9, 0, 1, 0>>