Skip to content

Allow checking if a vehicle measurement is supported by the underlying interface #42

@peplin

Description

@peplin

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
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    future workIssues that are not high on the priority list.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions