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.
/**
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.github.pires.obd.enums;
import java.util.HashMap;
import java.util.Map;
/**
* Select one of the Fuel Trim percentage banks to access.
*/
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");
private final int value;
private final String bank;
private static Map map = new HashMap();
static {
for (FuelTrim error : FuelTrim.values())
map.put(error.getValue(), error);
}
private FuelTrim(final int value, final String bank) {
this.value = value;
this.bank = bank;
}
/**
* 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;
}
/**
* 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);
}
/**
* buildObdCommand.
*
* @return a {@link java.lang.String} object.
*/
public final String buildObdCommand() {
return new String("01 " + value);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy