Trips

State

Type

Declaration

getType()

Discussion

Type of the trip

Example

val state:Trips.State
assertTrue(state.type.value == Trips.Type.SINGLE)
// Trip had a single stop

Driver name

Declaration

getDriverName()

Discussion

Name of the driver of the trip

Example

val state:Trips.State
assertTrue(state.driverName.value == "Hari Seldon")
// Driver name is 'Hari Seldon'

Description

Declaration

getDescription()

Discussion

Description of the trip

Example

val state:Trips.State
assertTrue(state.description.value == "To save humankind")
// Description of the trip is 'To save humankind'

Start time

Declaration

getStartTime()

Discussion

Start time of the trip

Example

val state:Trips.State
assertTrue(dateIsSame(state.startTime.value, "2020-06-19T12:12:10.000Z"))
// Trip started at 19 June 2020 at 12:12:10 GMT

End time

Declaration

getEndTime()

Discussion

End time of the trip

Example

val state:Trips.State
assertTrue(dateIsSame(state.endTime.value, "2020-06-19T13:12:10.000Z"))
// Trip ended at 19 June 2020 at 13:12:10 GMT

Start address

Declaration

getStartAddress()

Discussion

Start address of the trip

Example

val state:Trips.State
assertTrue(state.startAddress.value == "Skalitzer Straße 68, 10997 Berlin, Germany")
// Trip started from Skalitzer Straße 68, 10997 Berlin, Germany

End address

Declaration

getEndAddress()

Discussion

End address of the trip

Example

val state:Trips.State
assertTrue(state.endAddress.value == "Skalitzer Straße 68, 10997 Berlin, Germany")
// Trip ended at Skalitzer Straße 68, 10997 Berlin, Germany

Start coordinates

Declaration

getStartCoordinates()

Discussion

Start coordinates of the trip

Example

val state:Trips.State
assertTrue(state.startCoordinates.value?.latitude == 52.500276)
assertTrue(state.startCoordinates.value?.longitude == 13.439719)
// Trip started from 52.500276:13.439719

End coordinates

Declaration

getEndCoordinates()

Discussion

End coordinates of the trip

Example

val state:Trips.State
assertTrue(state.endCoordinates.value?.latitude == 52.500276)
assertTrue(state.endCoordinates.value?.longitude == 13.439719)
// Trip ended at 52.500276:13.439719

Start odometer

Declaration

getStartOdometer()

Discussion

Odometer reading at the start of the trip

Example

val state:Trips.State
assertTrue(state.startOdometer.value?.value == 10500.0)
assertTrue(state.startOdometer.value?.unit == Length.Unit.KILOMETERS)
// At the start of the trip the odometer was showing 10500.0km

End odometer

Declaration

getEndOdometer()

Discussion

Odometer reading at the end of the trip

Example

val state:Trips.State
assertTrue(state.endOdometer.value?.value == 10543.0)
assertTrue(state.endOdometer.value?.unit == Length.Unit.KILOMETERS)
// At the start of the trip the odometer was showing 10543.0km

Average fuel consumption

Declaration

getAverageFuelConsumption()

Discussion

Average fuel consumption during the trip

Example

val state:Trips.State
assertTrue(state.averageFuelConsumption.value?.value == 7.34)
assertTrue(state.averageFuelConsumption.value?.unit == FuelEfficiency.Unit.LITERS_PER_100_KILOMETERS)
// Average fuel consumption during the trip was 7.34 l/100km

Distance

Declaration

getDistance()

Discussion

Distance of the trip

Example

val state:Trips.State
assertTrue(state.distance.value?.value == 43.0)
assertTrue(state.distance.value?.unit == Length.Unit.KILOMETERS)
// Distance of trip was 43.0km

Start address components

Declaration

getStartAddressComponents()

Discussion

Start address components

Example

val state:Trips.State
assertTrue(state.startAddressComponents[0].value?.type == AddressComponent.Type.CITY)
assertTrue(state.startAddressComponents[0].value?.value == "Berlin")
// City component value is 'Berlin'

End address components

Declaration

getEndAddressComponents()

Discussion

End address components

Example

val state:Trips.State
assertTrue(state.endAddressComponents[0].value?.type == AddressComponent.Type.CITY)
assertTrue(state.endAddressComponents[0].value?.value == "Berlin")
// City component value is 'Berlin'

Event

Declaration

getEvent()

Example

val state:Trips.State
assertTrue(state.event.value == Trips.Event.HARSH_ACCELERATION)
// Driving event of harsh acceleration encountered

Eco level

Declaration

getEcoLevel()

Example

val state:Trips.State
assertTrue(state.ecoLevel.value == Trips.EcoLevel.HIGH)
// Eco driving level is high

Thresholds

Declaration

getThresholds()

Discussion

Eco driving thresholds

Example

val state:Trips.State
assertTrue(state.thresholds[0].value?.type == EcoDrivingThreshold.Type.ZERO)
assertTrue(state.thresholds[0].value?.value == 0.0)
// Eco driving zero-threshold is set at 0.0

Total fuel consumption

Declaration

getTotalFuelConsumption()

Discussion

Total fuel consumption during the trip

Example

val state:Trips.State
assertTrue(state.totalFuelConsumption.value?.value == 23.4)
assertTrue(state.totalFuelConsumption.value?.unit == Volume.Unit.LITERS)
// Total fuel consumption during the trip was 23.4 l

Total idle fuel consumption

Declaration

getTotalIdleFuelConsumption()

Discussion

Fuel consumed while idle since the last ignition on.

Example

val state:Trips.State
assertTrue(state.totalIdleFuelConsumption.value?.value == 2.5)
assertTrue(state.totalIdleFuelConsumption.value?.unit == Volume.Unit.LITERS)
// Since the last ignition the vehicle has consumed 2.5 l while ideling.

Maximum speed

Declaration

getMaximumSpeed()

Discussion

Maximum speed recorded since the last igntion on.

Example

val state:Trips.State
assertTrue(state.maximumSpeed.value?.value == 67.3)
assertTrue(state.maximumSpeed.value?.unit == Speed.Unit.KILOMETERS_PER_HOUR)
// Maximum speed since last ignition on is 67.3km/h