com.github.pires.obd.enums.FuelTrim Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of obd-java-api Show documentation
Show all versions of obd-java-api Show documentation
OBD Java API compatible with ELM327.
package com.github.pires.obd.enums;
import java.util.HashMap;
import java.util.Map;
/**
* Select one of the Fuel Trim percentage banks to access.
*
* @author pires
* @version $Id: $Id
*/
public enum FuelTrim {
SHORT_TERM_BANK_1(0x06, "Short Term Fuel Trim Bank 1"),
LONG_TERM_BANK_1(0x07, "Long Term Fuel Trim Bank 1"),
SHORT_TERM_BANK_2(0x08, "Short Term Fuel Trim Bank 2"),
LONG_TERM_BANK_2(0x09, "Long Term Fuel Trim Bank 2");
/** Constant map
*/
private static Map map = new HashMap<>();
static {
for (FuelTrim error : FuelTrim.values())
map.put(error.getValue(), error);
}
private final int value;
private final String bank;
private FuelTrim(final int value, final String bank) {
this.value = value;
this.bank = bank;
}
/**
* fromValue.
*
* @param value a int.
* @return a {@link com.github.pires.obd.enums.FuelTrim} object.
*/
public static FuelTrim fromValue(final int value) {
return map.get(value);
}
/**
* Getter for the field value
.
*
* @return a int.
*/
public int getValue() {
return value;
}
/**
* Getter for the field bank
.
*
* @return a {@link java.lang.String} object.
*/
public String getBank() {
return bank;
}
/**
* buildObdCommand.
*
* @return a {@link java.lang.String} object.
*/
public final String buildObdCommand() {
return new String("01 0" + value);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy