You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Allow checking if a vehicle measurement is supported by the underlying interface #42
The parent class provides a standard interface for all measurements, starting
with a way to determine if a specific data type is supported by the vehicle
you're running on:
if(vehicleService.supports(VehicleSpeed.class) {
// it supports it
} else {
// if we try to get it and it doesn't support it, we throw an
// UnsupportedMeasurementException
vehicleService.get(VehicleSpeed.class);
/* boom */
}
Some measurements may be supported, but may not have been received from the CAN
translator yet - it could be a malfunction, or you're just checking too early
for an infrequently updated measurement:
if(vehicleService.supports(VehicleSpeed.class) {
VehicleSpeed measurement = vehicleService.get(VehicleSpeed.class);
if(measurement.isNone()) {
// do stuff with it
}
}
Activity