Vehicle location
State
Coordinates
Declaration
getCoordinates()
Example
val state:VehicleLocation.State
assertTrue(state.coordinates.value?.latitude == 52.520008)
assertTrue(state.coordinates.value?.longitude == 13.404954)
// Vehicle coordinates are 52.520008:13.404954
Heading
Declaration
getHeading()
Discussion
Heading angle
Example
val state:VehicleLocation.State
assertTrue(state.heading.value?.value == 13.370123)
assertTrue(state.heading.value?.unit == Angle.Unit.DEGREES)
// Heading direction is 13.370123°
Altitude
Declaration
getAltitude()
Discussion
Altitude above the WGS 84 reference ellipsoid
Example
val state:VehicleLocation.State
assertTrue(state.altitude.value?.value == 133.5)
assertTrue(state.altitude.value?.unit == Length.Unit.METERS)
// Vehicle altitude is 133.5m
Precision
Declaration
getPrecision()
Example
val state:VehicleLocation.State
assertTrue(state.precision.value?.value == 500.0)
assertTrue(state.precision.value?.unit == Length.Unit.METERS)
// Precision is 500m
Gps source
Declaration
getGpsSource()
Discussion
Type of GPS source
Example
val state:VehicleLocation.State
assertTrue(state.gpsSource.value == VehicleLocation.GpsSource.REAL)
// The GPS signal is from a real source
Gps signal strength
Declaration
getGpsSignalStrength()
Discussion
GPS signal strength percentage between 0.0-1.0
Example
val state:VehicleLocation.State
assertTrue(state.gpsSignalStrength.value == 0.8)
// GPS signal strength is 80%
Getters
Get Vehicle Location property availability information
Declaration
public GetVehicleLocationAvailability()
public GetVehicleLocationAvailability(byte... propertyIdentifiers)
Example
// get all property availabilities
val getAvailability = GetVehicleLocationAvailability()
// get coordinates and heading property availabilities
val getAvailabilityProperties = GetVehicleLocationAvailability(0x04, 0x05)
Get vehicle location
Declaration
public GetVehicleLocation()
public GetVehicleLocation(byte... propertyIdentifiers)
Example
// get all properties
val getState = GetVehicleLocation()
// get coordinates and heading properties
val getStateProperties = GetVehicleLocation(0x04, 0x05)