Diagnostics

State

Mileage

Declaration

getMileage()

Discussion

The vehicle mileage (odometer)

Example

val state:Diagnostics.State
assertTrue(state.mileage.value?.value == 150000.0)
assertTrue(state.mileage.value?.unit == Length.Unit.KILOMETERS)
// Odometer is showing 150'000.0km

Engine oil temperature

Declaration

getEngineOilTemperature()

Discussion

Engine oil temperature

Example

val state:Diagnostics.State
assertTrue(state.engineOilTemperature.value?.value == 99.5)
assertTrue(state.engineOilTemperature.value?.unit == Temperature.Unit.CELSIUS)
// Engine oil temperature is 99.5°C

Speed

Declaration

getSpeed()

Discussion

The vehicle speed

Example

val state:Diagnostics.State
assertTrue(state.speed.value?.value == 60.0)
assertTrue(state.speed.value?.unit == Speed.Unit.KILOMETERS_PER_HOUR)
// Vehicle speed is 60.0km/h

Engine rpm

Declaration

getEngineRPM()

Discussion

Engine RPM (revolutions per minute)

Example

val state:Diagnostics.State
assertTrue(state.engineRPM.value?.value == 2500.0)
assertTrue(state.engineRPM.value?.unit == AngularVelocity.Unit.REVOLUTIONS_PER_MINUTE)
// Engine RPM is 2500.0

Fuel level

Declaration

getFuelLevel()

Discussion

Fuel level percentage between 0.0-1.0

Example

val state:Diagnostics.State
assertTrue(state.fuelLevel.value == 0.9)
// Fuel level is at 90%

Estimated range

Declaration

getEstimatedRange()

Discussion

Estimated range (with combustion engine)

Example

val state:Diagnostics.State
assertTrue(state.estimatedRange.value?.value == 265.0)
assertTrue(state.estimatedRange.value?.unit == Length.Unit.KILOMETERS)
// Estimated range is 256.0km

Washer fluid level

Declaration

getWasherFluidLevel()

Example

val state:Diagnostics.State
assertTrue(state.washerFluidLevel.value == FluidLevel.FILLED)
// Washer fluid is filled

Battery voltage

Declaration

getBatteryVoltage()

Discussion

Battery voltage

Example

val state:Diagnostics.State
assertTrue(state.batteryVoltage.value?.value == 12.1)
assertTrue(state.batteryVoltage.value?.unit == ElectricPotentialDifference.Unit.VOLTS)
// Battery voltage is 12.1V

Adblue level

Declaration

getAdBlueLevel()

Discussion

AdBlue level percentage between 0.0-1.0

Example

val state:Diagnostics.State
assertTrue(state.adBlueLevel.value == 0.9)
// AdBlue level is at 90%

Distance since reset

Declaration

getDistanceSinceReset()

Discussion

The distance driven since reset

Example

val state:Diagnostics.State
assertTrue(state.distanceSinceReset.value?.value == 1500.1)
assertTrue(state.distanceSinceReset.value?.unit == Length.Unit.KILOMETERS)
// 1'500.1km driven since reset

Distance since start

Declaration

getDistanceSinceStart()

Discussion

The distance driven since trip start

Example

val state:Diagnostics.State
assertTrue(state.distanceSinceStart.value?.value == 12.4)
assertTrue(state.distanceSinceStart.value?.unit == Length.Unit.KILOMETERS)
// 12.4km driven since the engine start

Fuel volume

Declaration

getFuelVolume()

Discussion

The fuel volume measured in liters

Example

val state:Diagnostics.State
assertTrue(state.fuelVolume.value?.value == 35.5)
assertTrue(state.fuelVolume.value?.unit == Volume.Unit.LITERS)
// 35.5L of fuel remaining

Anti lock braking

Declaration

getAntiLockBraking()

Example

val state:Diagnostics.State
assertTrue(state.antiLockBraking.value == ActiveState.ACTIVE)
// ABS is active

Engine coolant temperature

Declaration

getEngineCoolantTemperature()

Discussion

Engine coolant temperature

Example

val state:Diagnostics.State
assertTrue(state.engineCoolantTemperature.value?.value == 20.0)
assertTrue(state.engineCoolantTemperature.value?.unit == Temperature.Unit.CELSIUS)
// Engine coolant temperature is 20°C

Engine total operating hours

Declaration

getEngineTotalOperatingHours()

Discussion

The accumulated time of engine operation

Example

val state:Diagnostics.State
assertTrue(state.engineTotalOperatingHours.value?.value == 1500.65)
assertTrue(state.engineTotalOperatingHours.value?.unit == Duration.Unit.HOURS)
// The engine has operated 1'500.65h in total

Engine total fuel consumption

Declaration

getEngineTotalFuelConsumption()

Discussion

The accumulated lifespan fuel consumption

Example

val state:Diagnostics.State
assertTrue(state.engineTotalFuelConsumption.value?.value == 27587.0)
assertTrue(state.engineTotalFuelConsumption.value?.unit == Volume.Unit.LITERS)
// The engine has consumend 27'587.0L of fuel over it's lifespan

Brake fluid level

Declaration

getBrakeFluidLevel()

Example

val state:Diagnostics.State
assertTrue(state.brakeFluidLevel.value == FluidLevel.LOW)
// Brake fluid is low

Engine torque

Declaration

getEngineTorque()

Discussion

Current engine torque percentage between 0.0-1.0

Example

val state:Diagnostics.State
assertTrue(state.engineTorque.value == 0.2)
// Engine torque is currently at 20%

Engine load

Declaration

getEngineLoad()

Discussion

Current engine load percentage between 0.0-1.0

Example

val state:Diagnostics.State
assertTrue(state.engineLoad.value == 0.1)
// Engine load is currently at 10%

Wheel based speed

Declaration

getWheelBasedSpeed()

Discussion

The vehicle speed measured at the wheel base

Example

val state:Diagnostics.State
assertTrue(state.wheelBasedSpeed.value?.value == 65.0)
assertTrue(state.wheelBasedSpeed.value?.unit == Speed.Unit.KILOMETERS_PER_HOUR)
// Wheel based speed is 65.0km/h

Battery level

Declaration

getBatteryLevel()

Discussion

Battery level in %, value between 0.0 and 1.0

Example

val state:Diagnostics.State
assertTrue(state.batteryLevel.value == 0.56)
// Battery level is at 56%

Check control messages

Declaration

getCheckControlMessages()

Example

val state:Diagnostics.State
assertTrue(state.checkControlMessages[0].value?.id == 1)
assertTrue(state.checkControlMessages[0].value?.remainingTime?.value == 105592.0)
assertTrue(state.checkControlMessages[0].value?.remainingTime?.unit == Duration.Unit.MINUTES)
assertTrue(state.checkControlMessages[0].value?.text == "Check engine")
assertTrue(state.checkControlMessages[0].value?.status == "Alert")
// 105'592 minutes remaining for Check Engine Alert control message with ID 1

Tire pressures

Declaration

getTirePressures()

Example

val state:Diagnostics.State
assertTrue(state.tirePressures[0].value?.location == LocationWheel.FRONT_LEFT)
assertTrue(state.tirePressures[0].value?.pressure?.value == 2.31)
assertTrue(state.tirePressures[0].value?.pressure?.unit == Pressure.Unit.BARS)
// Front left tire pressure is 2.31BAR

Tire temperatures

Declaration

getTireTemperatures()

Example

val state:Diagnostics.State
assertTrue(state.tireTemperatures[0].value?.location == LocationWheel.FRONT_LEFT)
assertTrue(state.tireTemperatures[0].value?.temperature?.value == 40.1)
assertTrue(state.tireTemperatures[0].value?.temperature?.unit == Temperature.Unit.CELSIUS)
// Front left tire temperature is 40.1°C

Wheel rpms

Declaration

getWheelRPMs()

Example

val state:Diagnostics.State
assertTrue(state.wheelRPMs[0].value?.location == LocationWheel.FRONT_LEFT)
assertTrue(state.wheelRPMs[0].value?.rpm?.value == 737.0)
assertTrue(state.wheelRPMs[0].value?.rpm?.unit == AngularVelocity.Unit.REVOLUTIONS_PER_MINUTE)
// Front left wheel is doing 737.0RPM

Trouble codes

Declaration

getTroubleCodes()

Example

val state:Diagnostics.State
assertTrue(state.troubleCodes[0].value?.occurrences == 2)
assertTrue(state.troubleCodes[0].value?.id == "C1116FA")
assertTrue(state.troubleCodes[0].value?.ecuID == "RDU_212FR")
assertTrue(state.troubleCodes[0].value?.status == "PENDING")
assertTrue(state.troubleCodes[0].value?.system == TroubleCode.System.UNKNOWN)
// Trouble code 'C1116FA' with ECU-ID 'RDU_212FR' occurred 2 times and is 'PENDING'

Mileage meters

Declaration

getMileageMeters()

Discussion

The vehicle mileage (odometer) in meters

Example

val state:Diagnostics.State
assertTrue(state.mileageMeters.value?.value == 150001.0)
assertTrue(state.mileageMeters.value?.unit == Length.Unit.KILOMETERS)
// Odometer is showing 150'001km

Odometer

Declaration

getOdometer()

Discussion

The vehicle odometer value in a given units.

Example

val state:Diagnostics.State
assertTrue(state.odometer.value?.value == 6.4)
assertTrue(state.odometer.value?.unit == Length.Unit.MEGAMETERS)
// Odometer is showing 6.4Mm – length of the Great Wall.

Engine total operating time

Declaration

getEngineTotalOperatingTime()

Discussion

The accumulated time of engine operation

Example

val state:Diagnostics.State
assertTrue(state.engineTotalOperatingTime.value?.value == 1500.65)
assertTrue(state.engineTotalOperatingTime.value?.unit == Duration.Unit.HOURS)
// The engine has operated 1'500.65h in total

Tire pressure statuses

Declaration

getTirePressureStatuses()

Example

val state:Diagnostics.State
assertTrue(state.tirePressureStatuses[0].value?.location == LocationWheel.FRONT_LEFT)
assertTrue(state.tirePressureStatuses[0].value?.status == TirePressureStatus.Status.NORMAL)
// Front left tire pressure is normal

Brake lining wear pre warning

Declaration

getBrakeLiningWearPreWarning()

Discussion

Status of brake lining wear pre-warning

Example

val state:Diagnostics.State
assertTrue(state.brakeLiningWearPreWarning.value == ActiveState.INACTIVE)
// Brake lining wear pre-warning is inactive

Engine oil life remaining

Declaration

getEngineOilLifeRemaining()

Discussion

Remaining life of engine oil which decreases over time

Example

val state:Diagnostics.State
assertTrue(state.engineOilLifeRemaining.value == 0.88)
// Engine oil life remaining is 88%

Oem trouble code values

Declaration

getOemTroubleCodeValues()

Discussion

Additional OEM trouble codes

Example

val state:Diagnostics.State
assertTrue(state.oemTroubleCodeValues[0].value?.id == "123ID")
assertTrue(state.oemTroubleCodeValues[0].value?.keyValue?.key == "some_error")
assertTrue(state.oemTroubleCodeValues[0].value?.keyValue?.value == "some_value")
// Trouble code '123ID' has a value 'some_value' for a key 'some_error'

Diesel exhaust fluid range

Declaration

getDieselExhaustFluidRange()

Discussion

Distance remaining until diesel exhaust fluid is empty

Example

val state:Diagnostics.State
assertTrue(state.dieselExhaustFluidRange.value?.value == 2233.0)
assertTrue(state.dieselExhaustFluidRange.value?.unit == Length.Unit.KILOMETERS)
// Diesel exhaust fluid is empty in 2233.0km

Diesel particulate filter soot level

Declaration

getDieselParticulateFilterSootLevel()

Discussion

Level of soot in diesel exhaust particulate filter

Example

val state:Diagnostics.State
assertTrue(state.dieselParticulateFilterSootLevel.value == 0.16)
// Diesel exhaust particulate filter soot level is 16%

Confirmed trouble codes

Declaration

getConfirmedTroubleCodes()

Example

val state:Diagnostics.State
assertTrue(state.confirmedTroubleCodes[0].value?.id == "801C10")
assertTrue(state.confirmedTroubleCodes[0].value?.ecuAddress == "16")
assertTrue(state.confirmedTroubleCodes[0].value?.ecuVariantName == "CAS")
assertTrue(state.confirmedTroubleCodes[0].value?.status == "ACTIVE")
// Confirmed trouble code '801C10' with ECU address '16' and variante name "CAS" is 'ACTIVE'

Diesel exhaust filter status

Declaration

getDieselExhaustFilterStatus()

Example

val state:Diagnostics.State
assertTrue(state.dieselExhaustFilterStatus.value?.status == DieselExhaustFilterStatus.Status.UNKNOWN)
assertTrue(state.dieselExhaustFilterStatus.value?.component == DieselExhaustFilterStatus.Component.EXHAUST_FILTER)
assertTrue(state.dieselExhaustFilterStatus.value?.cleaning == DieselExhaustFilterStatus.Cleaning.UNKNOWN)
// Diesel 'exhaust filter' is in 'unknown' status and unknown cleaning state

Getters

Get Diagnostics property availability information

Declaration

public GetStateAvailability()
public GetStateAvailability(byte... propertyIdentifiers)

Example

// get all property availabilities
val getAvailability = GetStateAvailability()
// get mileage and engineOilTemperature property availabilities
val getAvailabilityProperties = GetStateAvailability(0x01, 0x02)

Get Diagnostics properties

Declaration

public GetState()
public GetState(byte... propertyIdentifiers)            

Example

// get all properties
val getState = GetState()
// get mileage and engineOilTemperature properties
val getStateProperties = GetState(0x01, 0x02)