Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
peplin opened this issue May 22, 2013 · 0 comments
Labels
future work Issues that are not high on the priority list.
Milestone

Comments

@peplin
Copy link
Member

peplin commented May 22, 2013

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
    }
}
@emarsman emarsman added the future work Issues that are not high on the priority list. label Feb 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
future work Issues that are not high on the priority list.
Projects
None yet
Development

No branches or pull requests

2 participants