Remove the CarDiagnosticSensorIndices class as it merely acted as a hollow namespace
Bug: 64024685
Test: build
Change-Id: Idde0e66904d4d5fd620e38815961af0eda5c1ec3
diff --git a/car-lib/api/system-current.txt b/car-lib/api/system-current.txt
index d30819d..fe2794b 100644
--- a/car-lib/api/system-current.txt
+++ b/car-lib/api/system-current.txt
@@ -497,123 +497,6 @@
method public abstract void onDiagnosticEvent(android.car.hardware.CarDiagnosticEvent);
}
- public final class CarDiagnosticSensorIndices {
- ctor public CarDiagnosticSensorIndices();
- }
-
- public static final class CarDiagnosticSensorIndices.FloatSensorIndex {
- field public static final int ABSOLUTE_EVAPORATION_SYSTEM_VAPOR_PRESSURE = 58; // 0x3a
- field public static final int ABSOLUTE_LOAD_VALUE = 48; // 0x30
- field public static final int ABSOLUTE_THROTTLE_POSITION_B = 51; // 0x33
- field public static final int ABSOLUTE_THROTTLE_POSITION_C = 52; // 0x34
- field public static final int ACCELERATOR_PEDAL_POSITION_D = 53; // 0x35
- field public static final int ACCELERATOR_PEDAL_POSITION_E = 54; // 0x36
- field public static final int ACCELERATOR_PEDAL_POSITION_F = 55; // 0x37
- field public static final int CALCULATED_ENGINE_LOAD = 0; // 0x0
- field public static final int CATALYST_TEMPERATURE_BANK1_SENSOR1 = 44; // 0x2c
- field public static final int CATALYST_TEMPERATURE_BANK1_SENSOR2 = 46; // 0x2e
- field public static final int CATALYST_TEMPERATURE_BANK2_SENSOR1 = 45; // 0x2d
- field public static final int CATALYST_TEMPERATURE_BANK2_SENSOR2 = 47; // 0x2f
- field public static final int COMMANDED_EVAPORATIVE_PURGE = 41; // 0x29
- field public static final int COMMANDED_EXHAUST_GAS_RECIRCULATION = 39; // 0x27
- field public static final int COMMANDED_THROTTLE_ACTUATOR = 56; // 0x38
- field public static final int ENGINE_COOLANT_TEMPERATURE = 1; // 0x1
- field public static final int ENGINE_FUEL_RATE = 70; // 0x46
- field public static final int ENGINE_RPM = 8; // 0x8
- field public static final int ETHANOL_FUEL_PERCENTAGE = 57; // 0x39
- field public static final int EVAPORATION_SYSTEM_VAPOR_PRESSURE = 43; // 0x2b
- field public static final int EXHAUST_GAS_RECIRCULATION_ERROR = 40; // 0x28
- field public static final int FUEL_AIR_COMMANDED_EQUIVALENCE_RATIO = 49; // 0x31
- field public static final int FUEL_INJECTION_TIMING = 69; // 0x45
- field public static final int FUEL_PRESSURE = 6; // 0x6
- field public static final int FUEL_RAIL_GAUGE_PRESSURE = 38; // 0x26
- field public static final int FUEL_RAIL_PRESSURE = 37; // 0x25
- field public static final int FUEL_TANK_LEVEL_INPUT = 42; // 0x2a
- field public static final int HYBRID_BATTERY_PACK_REMAINING_LIFE = 68; // 0x44
- field public static final int INTAKE_MANIFOLD_ABSOLUTE_PRESSURE = 7; // 0x7
- field public static final int LAST_SYSTEM = 70; // 0x46
- field public static final int LONG_TERM_FUEL_TRIM_BANK1 = 3; // 0x3
- field public static final int LONG_TERM_FUEL_TRIM_BANK2 = 5; // 0x5
- field public static final int LONG_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK1 = 63; // 0x3f
- field public static final int LONG_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK2 = 64; // 0x40
- field public static final int LONG_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK3 = 65; // 0x41
- field public static final int LONG_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK4 = 66; // 0x42
- field public static final int MAF_AIR_FLOW_RATE = 11; // 0xb
- field public static final int OXYGEN_SENSOR1_FUEL_AIR_EQUIVALENCE_RATIO = 15; // 0xf
- field public static final int OXYGEN_SENSOR1_SHORT_TERM_FUEL_TRIM = 14; // 0xe
- field public static final int OXYGEN_SENSOR1_VOLTAGE = 13; // 0xd
- field public static final int OXYGEN_SENSOR2_FUEL_AIR_EQUIVALENCE_RATIO = 18; // 0x12
- field public static final int OXYGEN_SENSOR2_SHORT_TERM_FUEL_TRIM = 17; // 0x11
- field public static final int OXYGEN_SENSOR2_VOLTAGE = 16; // 0x10
- field public static final int OXYGEN_SENSOR3_FUEL_AIR_EQUIVALENCE_RATIO = 21; // 0x15
- field public static final int OXYGEN_SENSOR3_SHORT_TERM_FUEL_TRIM = 20; // 0x14
- field public static final int OXYGEN_SENSOR3_VOLTAGE = 19; // 0x13
- field public static final int OXYGEN_SENSOR4_FUEL_AIR_EQUIVALENCE_RATIO = 24; // 0x18
- field public static final int OXYGEN_SENSOR4_SHORT_TERM_FUEL_TRIM = 23; // 0x17
- field public static final int OXYGEN_SENSOR4_VOLTAGE = 22; // 0x16
- field public static final int OXYGEN_SENSOR5_FUEL_AIR_EQUIVALENCE_RATIO = 27; // 0x1b
- field public static final int OXYGEN_SENSOR5_SHORT_TERM_FUEL_TRIM = 26; // 0x1a
- field public static final int OXYGEN_SENSOR5_VOLTAGE = 25; // 0x19
- field public static final int OXYGEN_SENSOR6_FUEL_AIR_EQUIVALENCE_RATIO = 30; // 0x1e
- field public static final int OXYGEN_SENSOR6_SHORT_TERM_FUEL_TRIM = 29; // 0x1d
- field public static final int OXYGEN_SENSOR6_VOLTAGE = 28; // 0x1c
- field public static final int OXYGEN_SENSOR7_FUEL_AIR_EQUIVALENCE_RATIO = 33; // 0x21
- field public static final int OXYGEN_SENSOR7_SHORT_TERM_FUEL_TRIM = 32; // 0x20
- field public static final int OXYGEN_SENSOR7_VOLTAGE = 31; // 0x1f
- field public static final int OXYGEN_SENSOR8_FUEL_AIR_EQUIVALENCE_RATIO = 36; // 0x24
- field public static final int OXYGEN_SENSOR8_SHORT_TERM_FUEL_TRIM = 35; // 0x23
- field public static final int OXYGEN_SENSOR8_VOLTAGE = 34; // 0x22
- field public static final int RELATIVE_ACCELERATOR_PEDAL_POSITION = 67; // 0x43
- field public static final int RELATIVE_THROTTLE_POSITION = 50; // 0x32
- field public static final int SHORT_TERM_FUEL_TRIM_BANK1 = 2; // 0x2
- field public static final int SHORT_TERM_FUEL_TRIM_BANK2 = 4; // 0x4
- field public static final int SHORT_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK1 = 59; // 0x3b
- field public static final int SHORT_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK2 = 60; // 0x3c
- field public static final int SHORT_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK3 = 61; // 0x3d
- field public static final int SHORT_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK4 = 62; // 0x3e
- field public static final int THROTTLE_POSITION = 12; // 0xc
- field public static final int TIMING_ADVANCE = 10; // 0xa
- field public static final int VEHICLE_SPEED = 9; // 0x9
- field public static final int VENDOR_START = 71; // 0x47
- }
-
- public static final class CarDiagnosticSensorIndices.IntegerSensorIndex {
- field public static final int ABSOLUTE_BAROMETRIC_PRESSURE = 11; // 0xb
- field public static final int AMBIENT_AIR_TEMPERATURE = 13; // 0xd
- field public static final int COMMANDED_SECONDARY_AIR_STATUS = 5; // 0x5
- field public static final int CONTROL_MODULE_VOLTAGE = 12; // 0xc
- field public static final int DISTANCE_TRAVELED_SINCE_CODES_CLEARED = 10; // 0xa
- field public static final int DISTANCE_TRAVELED_WITH_MALFUNCTION_INDICATOR_LIGHT_ON = 8; // 0x8
- field public static final int DRIVER_DEMAND_PERCENT_TORQUE = 24; // 0x18
- field public static final int ENGINE_ACTUAL_PERCENT_TORQUE = 25; // 0x19
- field public static final int ENGINE_OIL_TEMPERATURE = 23; // 0x17
- field public static final int ENGINE_PERCENT_TORQUE_DATA_IDLE = 27; // 0x1b
- field public static final int ENGINE_PERCENT_TORQUE_DATA_POINT1 = 28; // 0x1c
- field public static final int ENGINE_PERCENT_TORQUE_DATA_POINT2 = 29; // 0x1d
- field public static final int ENGINE_PERCENT_TORQUE_DATA_POINT3 = 30; // 0x1e
- field public static final int ENGINE_PERCENT_TORQUE_DATA_POINT4 = 31; // 0x1f
- field public static final int ENGINE_REFERENCE_PERCENT_TORQUE = 26; // 0x1a
- field public static final int FUEL_RAIL_ABSOLUTE_PRESSURE = 22; // 0x16
- field public static final int FUEL_SYSTEM_STATUS = 0; // 0x0
- field public static final int FUEL_TYPE = 21; // 0x15
- field public static final int IGNITION_MONITORS_SUPPORTED = 2; // 0x2
- field public static final int IGNITION_SPECIFIC_MONITORS = 3; // 0x3
- field public static final int INTAKE_AIR_TEMPERATURE = 4; // 0x4
- field public static final int LAST_SYSTEM = 31; // 0x1f
- field public static final int MALFUNCTION_INDICATOR_LIGHT_ON = 1; // 0x1
- field public static final int MAX_AIR_FLOW_RATE_FROM_MASS_AIR_FLOW_SENSOR = 20; // 0x14
- field public static final int MAX_FUEL_AIR_EQUIVALENCE_RATIO = 16; // 0x10
- field public static final int MAX_INTAKE_MANIFOLD_ABSOLUTE_PRESSURE = 19; // 0x13
- field public static final int MAX_OXYGEN_SENSOR_CURRENT = 18; // 0x12
- field public static final int MAX_OXYGEN_SENSOR_VOLTAGE = 17; // 0x11
- field public static final int NUM_OXYGEN_SENSORS_PRESENT = 6; // 0x6
- field public static final int RUNTIME_SINCE_ENGINE_START = 7; // 0x7
- field public static final int TIME_SINCE_TROUBLE_CODES_CLEARED = 15; // 0xf
- field public static final int TIME_WITH_MALFUNCTION_LIGHT_ON = 14; // 0xe
- field public static final int VENDOR_START = 32; // 0x20
- field public static final int WARMUPS_SINCE_CODES_CLEARED = 9; // 0x9
- }
-
public class CarPropertyConfig<T> implements android.os.Parcelable {
method public int describeContents();
method public int getAreaCount();
@@ -762,6 +645,119 @@
method public abstract void onErrorEvent(int, int);
}
+ public final class FloatSensorIndex {
+ field public static final int ABSOLUTE_EVAPORATION_SYSTEM_VAPOR_PRESSURE = 58; // 0x3a
+ field public static final int ABSOLUTE_LOAD_VALUE = 48; // 0x30
+ field public static final int ABSOLUTE_THROTTLE_POSITION_B = 51; // 0x33
+ field public static final int ABSOLUTE_THROTTLE_POSITION_C = 52; // 0x34
+ field public static final int ACCELERATOR_PEDAL_POSITION_D = 53; // 0x35
+ field public static final int ACCELERATOR_PEDAL_POSITION_E = 54; // 0x36
+ field public static final int ACCELERATOR_PEDAL_POSITION_F = 55; // 0x37
+ field public static final int CALCULATED_ENGINE_LOAD = 0; // 0x0
+ field public static final int CATALYST_TEMPERATURE_BANK1_SENSOR1 = 44; // 0x2c
+ field public static final int CATALYST_TEMPERATURE_BANK1_SENSOR2 = 46; // 0x2e
+ field public static final int CATALYST_TEMPERATURE_BANK2_SENSOR1 = 45; // 0x2d
+ field public static final int CATALYST_TEMPERATURE_BANK2_SENSOR2 = 47; // 0x2f
+ field public static final int COMMANDED_EVAPORATIVE_PURGE = 41; // 0x29
+ field public static final int COMMANDED_EXHAUST_GAS_RECIRCULATION = 39; // 0x27
+ field public static final int COMMANDED_THROTTLE_ACTUATOR = 56; // 0x38
+ field public static final int ENGINE_COOLANT_TEMPERATURE = 1; // 0x1
+ field public static final int ENGINE_FUEL_RATE = 70; // 0x46
+ field public static final int ENGINE_RPM = 8; // 0x8
+ field public static final int ETHANOL_FUEL_PERCENTAGE = 57; // 0x39
+ field public static final int EVAPORATION_SYSTEM_VAPOR_PRESSURE = 43; // 0x2b
+ field public static final int EXHAUST_GAS_RECIRCULATION_ERROR = 40; // 0x28
+ field public static final int FUEL_AIR_COMMANDED_EQUIVALENCE_RATIO = 49; // 0x31
+ field public static final int FUEL_INJECTION_TIMING = 69; // 0x45
+ field public static final int FUEL_PRESSURE = 6; // 0x6
+ field public static final int FUEL_RAIL_GAUGE_PRESSURE = 38; // 0x26
+ field public static final int FUEL_RAIL_PRESSURE = 37; // 0x25
+ field public static final int FUEL_TANK_LEVEL_INPUT = 42; // 0x2a
+ field public static final int HYBRID_BATTERY_PACK_REMAINING_LIFE = 68; // 0x44
+ field public static final int INTAKE_MANIFOLD_ABSOLUTE_PRESSURE = 7; // 0x7
+ field public static final int LAST_SYSTEM = 70; // 0x46
+ field public static final int LONG_TERM_FUEL_TRIM_BANK1 = 3; // 0x3
+ field public static final int LONG_TERM_FUEL_TRIM_BANK2 = 5; // 0x5
+ field public static final int LONG_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK1 = 63; // 0x3f
+ field public static final int LONG_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK2 = 64; // 0x40
+ field public static final int LONG_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK3 = 65; // 0x41
+ field public static final int LONG_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK4 = 66; // 0x42
+ field public static final int MAF_AIR_FLOW_RATE = 11; // 0xb
+ field public static final int OXYGEN_SENSOR1_FUEL_AIR_EQUIVALENCE_RATIO = 15; // 0xf
+ field public static final int OXYGEN_SENSOR1_SHORT_TERM_FUEL_TRIM = 14; // 0xe
+ field public static final int OXYGEN_SENSOR1_VOLTAGE = 13; // 0xd
+ field public static final int OXYGEN_SENSOR2_FUEL_AIR_EQUIVALENCE_RATIO = 18; // 0x12
+ field public static final int OXYGEN_SENSOR2_SHORT_TERM_FUEL_TRIM = 17; // 0x11
+ field public static final int OXYGEN_SENSOR2_VOLTAGE = 16; // 0x10
+ field public static final int OXYGEN_SENSOR3_FUEL_AIR_EQUIVALENCE_RATIO = 21; // 0x15
+ field public static final int OXYGEN_SENSOR3_SHORT_TERM_FUEL_TRIM = 20; // 0x14
+ field public static final int OXYGEN_SENSOR3_VOLTAGE = 19; // 0x13
+ field public static final int OXYGEN_SENSOR4_FUEL_AIR_EQUIVALENCE_RATIO = 24; // 0x18
+ field public static final int OXYGEN_SENSOR4_SHORT_TERM_FUEL_TRIM = 23; // 0x17
+ field public static final int OXYGEN_SENSOR4_VOLTAGE = 22; // 0x16
+ field public static final int OXYGEN_SENSOR5_FUEL_AIR_EQUIVALENCE_RATIO = 27; // 0x1b
+ field public static final int OXYGEN_SENSOR5_SHORT_TERM_FUEL_TRIM = 26; // 0x1a
+ field public static final int OXYGEN_SENSOR5_VOLTAGE = 25; // 0x19
+ field public static final int OXYGEN_SENSOR6_FUEL_AIR_EQUIVALENCE_RATIO = 30; // 0x1e
+ field public static final int OXYGEN_SENSOR6_SHORT_TERM_FUEL_TRIM = 29; // 0x1d
+ field public static final int OXYGEN_SENSOR6_VOLTAGE = 28; // 0x1c
+ field public static final int OXYGEN_SENSOR7_FUEL_AIR_EQUIVALENCE_RATIO = 33; // 0x21
+ field public static final int OXYGEN_SENSOR7_SHORT_TERM_FUEL_TRIM = 32; // 0x20
+ field public static final int OXYGEN_SENSOR7_VOLTAGE = 31; // 0x1f
+ field public static final int OXYGEN_SENSOR8_FUEL_AIR_EQUIVALENCE_RATIO = 36; // 0x24
+ field public static final int OXYGEN_SENSOR8_SHORT_TERM_FUEL_TRIM = 35; // 0x23
+ field public static final int OXYGEN_SENSOR8_VOLTAGE = 34; // 0x22
+ field public static final int RELATIVE_ACCELERATOR_PEDAL_POSITION = 67; // 0x43
+ field public static final int RELATIVE_THROTTLE_POSITION = 50; // 0x32
+ field public static final int SHORT_TERM_FUEL_TRIM_BANK1 = 2; // 0x2
+ field public static final int SHORT_TERM_FUEL_TRIM_BANK2 = 4; // 0x4
+ field public static final int SHORT_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK1 = 59; // 0x3b
+ field public static final int SHORT_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK2 = 60; // 0x3c
+ field public static final int SHORT_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK3 = 61; // 0x3d
+ field public static final int SHORT_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK4 = 62; // 0x3e
+ field public static final int THROTTLE_POSITION = 12; // 0xc
+ field public static final int TIMING_ADVANCE = 10; // 0xa
+ field public static final int VEHICLE_SPEED = 9; // 0x9
+ field public static final int VENDOR_START = 71; // 0x47
+ }
+
+ public final class IntegerSensorIndex {
+ field public static final int ABSOLUTE_BAROMETRIC_PRESSURE = 11; // 0xb
+ field public static final int AMBIENT_AIR_TEMPERATURE = 13; // 0xd
+ field public static final int COMMANDED_SECONDARY_AIR_STATUS = 5; // 0x5
+ field public static final int CONTROL_MODULE_VOLTAGE = 12; // 0xc
+ field public static final int DISTANCE_TRAVELED_SINCE_CODES_CLEARED = 10; // 0xa
+ field public static final int DISTANCE_TRAVELED_WITH_MALFUNCTION_INDICATOR_LIGHT_ON = 8; // 0x8
+ field public static final int DRIVER_DEMAND_PERCENT_TORQUE = 24; // 0x18
+ field public static final int ENGINE_ACTUAL_PERCENT_TORQUE = 25; // 0x19
+ field public static final int ENGINE_OIL_TEMPERATURE = 23; // 0x17
+ field public static final int ENGINE_PERCENT_TORQUE_DATA_IDLE = 27; // 0x1b
+ field public static final int ENGINE_PERCENT_TORQUE_DATA_POINT1 = 28; // 0x1c
+ field public static final int ENGINE_PERCENT_TORQUE_DATA_POINT2 = 29; // 0x1d
+ field public static final int ENGINE_PERCENT_TORQUE_DATA_POINT3 = 30; // 0x1e
+ field public static final int ENGINE_PERCENT_TORQUE_DATA_POINT4 = 31; // 0x1f
+ field public static final int ENGINE_REFERENCE_PERCENT_TORQUE = 26; // 0x1a
+ field public static final int FUEL_RAIL_ABSOLUTE_PRESSURE = 22; // 0x16
+ field public static final int FUEL_SYSTEM_STATUS = 0; // 0x0
+ field public static final int FUEL_TYPE = 21; // 0x15
+ field public static final int IGNITION_MONITORS_SUPPORTED = 2; // 0x2
+ field public static final int IGNITION_SPECIFIC_MONITORS = 3; // 0x3
+ field public static final int INTAKE_AIR_TEMPERATURE = 4; // 0x4
+ field public static final int LAST_SYSTEM = 31; // 0x1f
+ field public static final int MALFUNCTION_INDICATOR_LIGHT_ON = 1; // 0x1
+ field public static final int MAX_AIR_FLOW_RATE_FROM_MASS_AIR_FLOW_SENSOR = 20; // 0x14
+ field public static final int MAX_FUEL_AIR_EQUIVALENCE_RATIO = 16; // 0x10
+ field public static final int MAX_INTAKE_MANIFOLD_ABSOLUTE_PRESSURE = 19; // 0x13
+ field public static final int MAX_OXYGEN_SENSOR_CURRENT = 18; // 0x12
+ field public static final int MAX_OXYGEN_SENSOR_VOLTAGE = 17; // 0x11
+ field public static final int NUM_OXYGEN_SENSORS_PRESENT = 6; // 0x6
+ field public static final int RUNTIME_SINCE_ENGINE_START = 7; // 0x7
+ field public static final int TIME_SINCE_TROUBLE_CODES_CLEARED = 15; // 0xf
+ field public static final int TIME_WITH_MALFUNCTION_LIGHT_ON = 14; // 0xe
+ field public static final int VENDOR_START = 32; // 0x20
+ field public static final int WARMUPS_SINCE_CODES_CLEARED = 9; // 0x9
+ }
+
}
package android.car.hardware.cabin {
diff --git a/car-lib/src/android/car/hardware/CarDiagnosticEvent.java b/car-lib/src/android/car/hardware/CarDiagnosticEvent.java
index c683ca7..a065b3b 100644
--- a/car-lib/src/android/car/hardware/CarDiagnosticEvent.java
+++ b/car-lib/src/android/car/hardware/CarDiagnosticEvent.java
@@ -253,13 +253,13 @@
SparseArray<Float> newFloatValues = floatValues.clone();
for (int i = 0; i < intValues.size(); ++i) {
int key = intValues.keyAt(i);
- if (key >= CarDiagnosticSensorIndices.IntegerSensorIndex.LAST_SYSTEM) {
+ if (key >= IntegerSensorIndex.LAST_SYSTEM) {
newIntValues.delete(key);
}
}
for (int i = 0; i < floatValues.size(); ++i) {
int key = floatValues.keyAt(i);
- if (key >= CarDiagnosticSensorIndices.FloatSensorIndex.LAST_SYSTEM) {
+ if (key >= FloatSensorIndex.LAST_SYSTEM) {
newFloatValues.delete(key);
}
}
@@ -398,7 +398,7 @@
* Returns defaultValue otherwise.
*/
public int getSystemIntegerSensor(
- @CarDiagnosticSensorIndices.DiagnosticIntegerSensorIndex int sensor, int defaultValue) {
+ @IntegerSensorIndex.SensorIndex int sensor, int defaultValue) {
return intValues.get(sensor, defaultValue);
}
@@ -407,7 +407,7 @@
* Returns defaultValue otherwise.
*/
public float getSystemFloatSensor(
- @CarDiagnosticSensorIndices.DiagnosticFloatSensorIndex int sensor, float defaultValue) {
+ @FloatSensorIndex.SensorIndex int sensor, float defaultValue) {
return floatValues.get(sensor, defaultValue);
}
@@ -432,7 +432,7 @@
* Returns null otherwise.
*/
public @Nullable Integer getSystemIntegerSensor(
- @CarDiagnosticSensorIndices.DiagnosticIntegerSensorIndex int sensor) {
+ @IntegerSensorIndex.SensorIndex int sensor) {
int index = intValues.indexOfKey(sensor);
if (index < 0) return null;
return intValues.valueAt(index);
@@ -443,7 +443,7 @@
* Returns null otherwise.
*/
public @Nullable Float getSystemFloatSensor(
- @CarDiagnosticSensorIndices.DiagnosticFloatSensorIndex int sensor) {
+ @FloatSensorIndex.SensorIndex int sensor) {
int index = floatValues.indexOfKey(sensor);
if (index < 0) return null;
return floatValues.valueAt(index);
@@ -471,7 +471,7 @@
/**
* Represents possible states of the fuel system; see {@link
- * CarDiagnosticSensorIndices.IntegerSensorIndex#FUEL_SYSTEM_STATUS}
+ * IntegerSensorIndex#FUEL_SYSTEM_STATUS}
*/
public static final class FuelSystemStatus {
private FuelSystemStatus() {}
@@ -496,7 +496,7 @@
/**
* Represents possible states of the secondary air system; see {@link
- * CarDiagnosticSensorIndices.IntegerSensorIndex#COMMANDED_SECONDARY_AIR_STATUS}
+ * IntegerSensorIndex#COMMANDED_SECONDARY_AIR_STATUS}
*/
public static final class SecondaryAirStatus {
private SecondaryAirStatus() {}
@@ -519,7 +519,7 @@
/**
* Represents possible types of fuel; see {@link
- * CarDiagnosticSensorIndices.IntegerSensorIndex#FUEL_TYPE}
+ * IntegerSensorIndex#FUEL_TYPE}
*/
public static final class FuelType {
private FuelType() {}
@@ -581,7 +581,13 @@
}
/**
+<<<<<<< HEAD
* Represents the state of an ignition monitor on a vehicle.
+=======
+ * Represents possible states of the ignition monitors on the vehicle; see {@link
+ * IntegerSensorIndex#IGNITION_MONITORS_SUPPORTED} see {@link
+ * IntegerSensorIndex#IGNITION_SPECIFIC_MONITORS}
+>>>>>>> 49cfe37f... Remove the CarDiagnosticSensorIndices class as it merely acted as a hollow namespace
*/
public static final class IgnitionMonitor {
public final boolean available;
@@ -809,8 +815,7 @@
* Returns null otherwise.
*/
public @Nullable @FuelSystemStatus.Status Integer getFuelSystemStatus() {
- return getSystemIntegerSensor(
- CarDiagnosticSensorIndices.IntegerSensorIndex.FUEL_SYSTEM_STATUS);
+ return getSystemIntegerSensor(IntegerSensorIndex.FUEL_SYSTEM_STATUS);
}
/**
@@ -818,8 +823,7 @@
* Returns null otherwise.
*/
public @Nullable @SecondaryAirStatus.Status Integer getSecondaryAirStatus() {
- return getSystemIntegerSensor(
- CarDiagnosticSensorIndices.IntegerSensorIndex.COMMANDED_SECONDARY_AIR_STATUS);
+ return getSystemIntegerSensor(IntegerSensorIndex.COMMANDED_SECONDARY_AIR_STATUS);
}
/**
@@ -828,13 +832,9 @@
*/
public @Nullable CommonIgnitionMonitors getIgnitionMonitors() {
Integer ignitionMonitorsType =
- getSystemIntegerSensor(
- CarDiagnosticSensorIndices.IntegerSensorIndex
- .IGNITION_MONITORS_SUPPORTED);
+ getSystemIntegerSensor(IntegerSensorIndex.IGNITION_MONITORS_SUPPORTED);
Integer ignitionMonitorsBitmask =
- getSystemIntegerSensor(
- CarDiagnosticSensorIndices.IntegerSensorIndex
- .IGNITION_SPECIFIC_MONITORS);
+ getSystemIntegerSensor(IntegerSensorIndex.IGNITION_SPECIFIC_MONITORS);
if (null == ignitionMonitorsType) return null;
if (null == ignitionMonitorsBitmask) return null;
switch (ignitionMonitorsType) {
@@ -852,6 +852,6 @@
* Returns null otherwise.
*/
public @Nullable @FuelType.Type Integer getFuelType() {
- return getSystemIntegerSensor(CarDiagnosticSensorIndices.IntegerSensorIndex.FUEL_TYPE);
+ return getSystemIntegerSensor(IntegerSensorIndex.FUEL_TYPE);
}
}
diff --git a/car-lib/src/android/car/hardware/CarDiagnosticSensorIndices.java b/car-lib/src/android/car/hardware/CarDiagnosticSensorIndices.java
deleted file mode 100644
index 5d19fca..0000000
--- a/car-lib/src/android/car/hardware/CarDiagnosticSensorIndices.java
+++ /dev/null
@@ -1,270 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * 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 android.car.hardware;
-
-import android.annotation.IntDef;
-import android.annotation.SystemApi;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-/**
- * This class is a container for the indices of integer and float diagnostic sensors.
- * These values are extracted from types.hal by packages/services/Car/tools/update-obd2-sensors.py
- *
- * DO NOT EDIT MANUALLY
- *
- * @hide
- */
-@SystemApi
-public final class CarDiagnosticSensorIndices {
- public static final class IntegerSensorIndex {
- private IntegerSensorIndex() {}
-
- public static final int FUEL_SYSTEM_STATUS = 0;
- public static final int MALFUNCTION_INDICATOR_LIGHT_ON = 1;
- public static final int IGNITION_MONITORS_SUPPORTED = 2;
- public static final int IGNITION_SPECIFIC_MONITORS = 3;
- public static final int INTAKE_AIR_TEMPERATURE = 4;
- public static final int COMMANDED_SECONDARY_AIR_STATUS = 5;
- public static final int NUM_OXYGEN_SENSORS_PRESENT = 6;
- public static final int RUNTIME_SINCE_ENGINE_START = 7;
- public static final int DISTANCE_TRAVELED_WITH_MALFUNCTION_INDICATOR_LIGHT_ON = 8;
- public static final int WARMUPS_SINCE_CODES_CLEARED = 9;
- public static final int DISTANCE_TRAVELED_SINCE_CODES_CLEARED = 10;
- public static final int ABSOLUTE_BAROMETRIC_PRESSURE = 11;
- public static final int CONTROL_MODULE_VOLTAGE = 12;
- public static final int AMBIENT_AIR_TEMPERATURE = 13;
- public static final int TIME_WITH_MALFUNCTION_LIGHT_ON = 14;
- public static final int TIME_SINCE_TROUBLE_CODES_CLEARED = 15;
- public static final int MAX_FUEL_AIR_EQUIVALENCE_RATIO = 16;
- public static final int MAX_OXYGEN_SENSOR_VOLTAGE = 17;
- public static final int MAX_OXYGEN_SENSOR_CURRENT = 18;
- public static final int MAX_INTAKE_MANIFOLD_ABSOLUTE_PRESSURE = 19;
- public static final int MAX_AIR_FLOW_RATE_FROM_MASS_AIR_FLOW_SENSOR = 20;
- public static final int FUEL_TYPE = 21;
- public static final int FUEL_RAIL_ABSOLUTE_PRESSURE = 22;
- public static final int ENGINE_OIL_TEMPERATURE = 23;
- public static final int DRIVER_DEMAND_PERCENT_TORQUE = 24;
- public static final int ENGINE_ACTUAL_PERCENT_TORQUE = 25;
- public static final int ENGINE_REFERENCE_PERCENT_TORQUE = 26;
- public static final int ENGINE_PERCENT_TORQUE_DATA_IDLE = 27;
- public static final int ENGINE_PERCENT_TORQUE_DATA_POINT1 = 28;
- public static final int ENGINE_PERCENT_TORQUE_DATA_POINT2 = 29;
- public static final int ENGINE_PERCENT_TORQUE_DATA_POINT3 = 30;
- public static final int ENGINE_PERCENT_TORQUE_DATA_POINT4 = 31;
- public static final int LAST_SYSTEM = ENGINE_PERCENT_TORQUE_DATA_POINT4;
- public static final int VENDOR_START = LAST_SYSTEM + 1;
- }
-
- public static final class FloatSensorIndex {
- private FloatSensorIndex() {}
-
- public static final int CALCULATED_ENGINE_LOAD = 0;
- public static final int ENGINE_COOLANT_TEMPERATURE = 1;
- public static final int SHORT_TERM_FUEL_TRIM_BANK1 = 2;
- public static final int LONG_TERM_FUEL_TRIM_BANK1 = 3;
- public static final int SHORT_TERM_FUEL_TRIM_BANK2 = 4;
- public static final int LONG_TERM_FUEL_TRIM_BANK2 = 5;
- public static final int FUEL_PRESSURE = 6;
- public static final int INTAKE_MANIFOLD_ABSOLUTE_PRESSURE = 7;
- public static final int ENGINE_RPM = 8;
- public static final int VEHICLE_SPEED = 9;
- public static final int TIMING_ADVANCE = 10;
- public static final int MAF_AIR_FLOW_RATE = 11;
- public static final int THROTTLE_POSITION = 12;
- public static final int OXYGEN_SENSOR1_VOLTAGE = 13;
- public static final int OXYGEN_SENSOR1_SHORT_TERM_FUEL_TRIM = 14;
- public static final int OXYGEN_SENSOR1_FUEL_AIR_EQUIVALENCE_RATIO = 15;
- public static final int OXYGEN_SENSOR2_VOLTAGE = 16;
- public static final int OXYGEN_SENSOR2_SHORT_TERM_FUEL_TRIM = 17;
- public static final int OXYGEN_SENSOR2_FUEL_AIR_EQUIVALENCE_RATIO = 18;
- public static final int OXYGEN_SENSOR3_VOLTAGE = 19;
- public static final int OXYGEN_SENSOR3_SHORT_TERM_FUEL_TRIM = 20;
- public static final int OXYGEN_SENSOR3_FUEL_AIR_EQUIVALENCE_RATIO = 21;
- public static final int OXYGEN_SENSOR4_VOLTAGE = 22;
- public static final int OXYGEN_SENSOR4_SHORT_TERM_FUEL_TRIM = 23;
- public static final int OXYGEN_SENSOR4_FUEL_AIR_EQUIVALENCE_RATIO = 24;
- public static final int OXYGEN_SENSOR5_VOLTAGE = 25;
- public static final int OXYGEN_SENSOR5_SHORT_TERM_FUEL_TRIM = 26;
- public static final int OXYGEN_SENSOR5_FUEL_AIR_EQUIVALENCE_RATIO = 27;
- public static final int OXYGEN_SENSOR6_VOLTAGE = 28;
- public static final int OXYGEN_SENSOR6_SHORT_TERM_FUEL_TRIM = 29;
- public static final int OXYGEN_SENSOR6_FUEL_AIR_EQUIVALENCE_RATIO = 30;
- public static final int OXYGEN_SENSOR7_VOLTAGE = 31;
- public static final int OXYGEN_SENSOR7_SHORT_TERM_FUEL_TRIM = 32;
- public static final int OXYGEN_SENSOR7_FUEL_AIR_EQUIVALENCE_RATIO = 33;
- public static final int OXYGEN_SENSOR8_VOLTAGE = 34;
- public static final int OXYGEN_SENSOR8_SHORT_TERM_FUEL_TRIM = 35;
- public static final int OXYGEN_SENSOR8_FUEL_AIR_EQUIVALENCE_RATIO = 36;
- public static final int FUEL_RAIL_PRESSURE = 37;
- public static final int FUEL_RAIL_GAUGE_PRESSURE = 38;
- public static final int COMMANDED_EXHAUST_GAS_RECIRCULATION = 39;
- public static final int EXHAUST_GAS_RECIRCULATION_ERROR = 40;
- public static final int COMMANDED_EVAPORATIVE_PURGE = 41;
- public static final int FUEL_TANK_LEVEL_INPUT = 42;
- public static final int EVAPORATION_SYSTEM_VAPOR_PRESSURE = 43;
- public static final int CATALYST_TEMPERATURE_BANK1_SENSOR1 = 44;
- public static final int CATALYST_TEMPERATURE_BANK2_SENSOR1 = 45;
- public static final int CATALYST_TEMPERATURE_BANK1_SENSOR2 = 46;
- public static final int CATALYST_TEMPERATURE_BANK2_SENSOR2 = 47;
- public static final int ABSOLUTE_LOAD_VALUE = 48;
- public static final int FUEL_AIR_COMMANDED_EQUIVALENCE_RATIO = 49;
- public static final int RELATIVE_THROTTLE_POSITION = 50;
- public static final int ABSOLUTE_THROTTLE_POSITION_B = 51;
- public static final int ABSOLUTE_THROTTLE_POSITION_C = 52;
- public static final int ACCELERATOR_PEDAL_POSITION_D = 53;
- public static final int ACCELERATOR_PEDAL_POSITION_E = 54;
- public static final int ACCELERATOR_PEDAL_POSITION_F = 55;
- public static final int COMMANDED_THROTTLE_ACTUATOR = 56;
- public static final int ETHANOL_FUEL_PERCENTAGE = 57;
- public static final int ABSOLUTE_EVAPORATION_SYSTEM_VAPOR_PRESSURE = 58;
- public static final int SHORT_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK1 = 59;
- public static final int SHORT_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK2 = 60;
- public static final int SHORT_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK3 = 61;
- public static final int SHORT_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK4 = 62;
- public static final int LONG_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK1 = 63;
- public static final int LONG_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK2 = 64;
- public static final int LONG_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK3 = 65;
- public static final int LONG_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK4 = 66;
- public static final int RELATIVE_ACCELERATOR_PEDAL_POSITION = 67;
- public static final int HYBRID_BATTERY_PACK_REMAINING_LIFE = 68;
- public static final int FUEL_INJECTION_TIMING = 69;
- public static final int ENGINE_FUEL_RATE = 70;
- public static final int LAST_SYSTEM = ENGINE_FUEL_RATE;
- public static final int VENDOR_START = LAST_SYSTEM + 1;
- }
-
- /** @hide */
- @Retention(RetentionPolicy.SOURCE)
- @IntDef({
- IntegerSensorIndex.FUEL_SYSTEM_STATUS,
- IntegerSensorIndex.MALFUNCTION_INDICATOR_LIGHT_ON,
- IntegerSensorIndex.IGNITION_MONITORS_SUPPORTED,
- IntegerSensorIndex.IGNITION_SPECIFIC_MONITORS,
- IntegerSensorIndex.INTAKE_AIR_TEMPERATURE,
- IntegerSensorIndex.COMMANDED_SECONDARY_AIR_STATUS,
- IntegerSensorIndex.NUM_OXYGEN_SENSORS_PRESENT,
- IntegerSensorIndex.RUNTIME_SINCE_ENGINE_START,
- IntegerSensorIndex.DISTANCE_TRAVELED_WITH_MALFUNCTION_INDICATOR_LIGHT_ON,
- IntegerSensorIndex.WARMUPS_SINCE_CODES_CLEARED,
- IntegerSensorIndex.DISTANCE_TRAVELED_SINCE_CODES_CLEARED,
- IntegerSensorIndex.ABSOLUTE_BAROMETRIC_PRESSURE,
- IntegerSensorIndex.CONTROL_MODULE_VOLTAGE,
- IntegerSensorIndex.AMBIENT_AIR_TEMPERATURE,
- IntegerSensorIndex.TIME_WITH_MALFUNCTION_LIGHT_ON,
- IntegerSensorIndex.TIME_SINCE_TROUBLE_CODES_CLEARED,
- IntegerSensorIndex.MAX_FUEL_AIR_EQUIVALENCE_RATIO,
- IntegerSensorIndex.MAX_OXYGEN_SENSOR_VOLTAGE,
- IntegerSensorIndex.MAX_OXYGEN_SENSOR_CURRENT,
- IntegerSensorIndex.MAX_INTAKE_MANIFOLD_ABSOLUTE_PRESSURE,
- IntegerSensorIndex.MAX_AIR_FLOW_RATE_FROM_MASS_AIR_FLOW_SENSOR,
- IntegerSensorIndex.FUEL_TYPE,
- IntegerSensorIndex.FUEL_RAIL_ABSOLUTE_PRESSURE,
- IntegerSensorIndex.ENGINE_OIL_TEMPERATURE,
- IntegerSensorIndex.DRIVER_DEMAND_PERCENT_TORQUE,
- IntegerSensorIndex.ENGINE_ACTUAL_PERCENT_TORQUE,
- IntegerSensorIndex.ENGINE_REFERENCE_PERCENT_TORQUE,
- IntegerSensorIndex.ENGINE_PERCENT_TORQUE_DATA_IDLE,
- IntegerSensorIndex.ENGINE_PERCENT_TORQUE_DATA_POINT1,
- IntegerSensorIndex.ENGINE_PERCENT_TORQUE_DATA_POINT2,
- IntegerSensorIndex.ENGINE_PERCENT_TORQUE_DATA_POINT3,
- IntegerSensorIndex.ENGINE_PERCENT_TORQUE_DATA_POINT4,
- IntegerSensorIndex.LAST_SYSTEM,
- IntegerSensorIndex.VENDOR_START,
- })
- public @interface DiagnosticIntegerSensorIndex {}
-
- /** @hide */
- @Retention(RetentionPolicy.SOURCE)
- @IntDef({
- FloatSensorIndex.CALCULATED_ENGINE_LOAD,
- FloatSensorIndex.ENGINE_COOLANT_TEMPERATURE,
- FloatSensorIndex.SHORT_TERM_FUEL_TRIM_BANK1,
- FloatSensorIndex.LONG_TERM_FUEL_TRIM_BANK1,
- FloatSensorIndex.SHORT_TERM_FUEL_TRIM_BANK2,
- FloatSensorIndex.LONG_TERM_FUEL_TRIM_BANK2,
- FloatSensorIndex.FUEL_PRESSURE,
- FloatSensorIndex.INTAKE_MANIFOLD_ABSOLUTE_PRESSURE,
- FloatSensorIndex.ENGINE_RPM,
- FloatSensorIndex.VEHICLE_SPEED,
- FloatSensorIndex.TIMING_ADVANCE,
- FloatSensorIndex.MAF_AIR_FLOW_RATE,
- FloatSensorIndex.THROTTLE_POSITION,
- FloatSensorIndex.OXYGEN_SENSOR1_VOLTAGE,
- FloatSensorIndex.OXYGEN_SENSOR1_SHORT_TERM_FUEL_TRIM,
- FloatSensorIndex.OXYGEN_SENSOR1_FUEL_AIR_EQUIVALENCE_RATIO,
- FloatSensorIndex.OXYGEN_SENSOR2_VOLTAGE,
- FloatSensorIndex.OXYGEN_SENSOR2_SHORT_TERM_FUEL_TRIM,
- FloatSensorIndex.OXYGEN_SENSOR2_FUEL_AIR_EQUIVALENCE_RATIO,
- FloatSensorIndex.OXYGEN_SENSOR3_VOLTAGE,
- FloatSensorIndex.OXYGEN_SENSOR3_SHORT_TERM_FUEL_TRIM,
- FloatSensorIndex.OXYGEN_SENSOR3_FUEL_AIR_EQUIVALENCE_RATIO,
- FloatSensorIndex.OXYGEN_SENSOR4_VOLTAGE,
- FloatSensorIndex.OXYGEN_SENSOR4_SHORT_TERM_FUEL_TRIM,
- FloatSensorIndex.OXYGEN_SENSOR4_FUEL_AIR_EQUIVALENCE_RATIO,
- FloatSensorIndex.OXYGEN_SENSOR5_VOLTAGE,
- FloatSensorIndex.OXYGEN_SENSOR5_SHORT_TERM_FUEL_TRIM,
- FloatSensorIndex.OXYGEN_SENSOR5_FUEL_AIR_EQUIVALENCE_RATIO,
- FloatSensorIndex.OXYGEN_SENSOR6_VOLTAGE,
- FloatSensorIndex.OXYGEN_SENSOR6_SHORT_TERM_FUEL_TRIM,
- FloatSensorIndex.OXYGEN_SENSOR6_FUEL_AIR_EQUIVALENCE_RATIO,
- FloatSensorIndex.OXYGEN_SENSOR7_VOLTAGE,
- FloatSensorIndex.OXYGEN_SENSOR7_SHORT_TERM_FUEL_TRIM,
- FloatSensorIndex.OXYGEN_SENSOR7_FUEL_AIR_EQUIVALENCE_RATIO,
- FloatSensorIndex.OXYGEN_SENSOR8_VOLTAGE,
- FloatSensorIndex.OXYGEN_SENSOR8_SHORT_TERM_FUEL_TRIM,
- FloatSensorIndex.OXYGEN_SENSOR8_FUEL_AIR_EQUIVALENCE_RATIO,
- FloatSensorIndex.FUEL_RAIL_PRESSURE,
- FloatSensorIndex.FUEL_RAIL_GAUGE_PRESSURE,
- FloatSensorIndex.COMMANDED_EXHAUST_GAS_RECIRCULATION,
- FloatSensorIndex.EXHAUST_GAS_RECIRCULATION_ERROR,
- FloatSensorIndex.COMMANDED_EVAPORATIVE_PURGE,
- FloatSensorIndex.FUEL_TANK_LEVEL_INPUT,
- FloatSensorIndex.EVAPORATION_SYSTEM_VAPOR_PRESSURE,
- FloatSensorIndex.CATALYST_TEMPERATURE_BANK1_SENSOR1,
- FloatSensorIndex.CATALYST_TEMPERATURE_BANK2_SENSOR1,
- FloatSensorIndex.CATALYST_TEMPERATURE_BANK1_SENSOR2,
- FloatSensorIndex.CATALYST_TEMPERATURE_BANK2_SENSOR2,
- FloatSensorIndex.ABSOLUTE_LOAD_VALUE,
- FloatSensorIndex.FUEL_AIR_COMMANDED_EQUIVALENCE_RATIO,
- FloatSensorIndex.RELATIVE_THROTTLE_POSITION,
- FloatSensorIndex.ABSOLUTE_THROTTLE_POSITION_B,
- FloatSensorIndex.ABSOLUTE_THROTTLE_POSITION_C,
- FloatSensorIndex.ACCELERATOR_PEDAL_POSITION_D,
- FloatSensorIndex.ACCELERATOR_PEDAL_POSITION_E,
- FloatSensorIndex.ACCELERATOR_PEDAL_POSITION_F,
- FloatSensorIndex.COMMANDED_THROTTLE_ACTUATOR,
- FloatSensorIndex.ETHANOL_FUEL_PERCENTAGE,
- FloatSensorIndex.ABSOLUTE_EVAPORATION_SYSTEM_VAPOR_PRESSURE,
- FloatSensorIndex.SHORT_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK1,
- FloatSensorIndex.SHORT_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK2,
- FloatSensorIndex.SHORT_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK3,
- FloatSensorIndex.SHORT_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK4,
- FloatSensorIndex.LONG_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK1,
- FloatSensorIndex.LONG_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK2,
- FloatSensorIndex.LONG_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK3,
- FloatSensorIndex.LONG_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK4,
- FloatSensorIndex.RELATIVE_ACCELERATOR_PEDAL_POSITION,
- FloatSensorIndex.HYBRID_BATTERY_PACK_REMAINING_LIFE,
- FloatSensorIndex.FUEL_INJECTION_TIMING,
- FloatSensorIndex.ENGINE_FUEL_RATE,
- FloatSensorIndex.LAST_SYSTEM,
- FloatSensorIndex.VENDOR_START,
- })
- public @interface DiagnosticFloatSensorIndex {}
-
-}
diff --git a/car-lib/src/android/car/hardware/FloatSensorIndex.java b/car-lib/src/android/car/hardware/FloatSensorIndex.java
new file mode 100644
index 0000000..18d54d7
--- /dev/null
+++ b/car-lib/src/android/car/hardware/FloatSensorIndex.java
@@ -0,0 +1,190 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * 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 android.car.hardware;
+
+import android.annotation.IntDef;
+import android.annotation.SystemApi;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * This class is a container for the indices of diagnostic sensors. The values are extracted by
+ * running packages/services/Car/tools/update-obd2-sensors.py against types.hal.
+ *
+ * DO NOT EDIT MANUALLY
+ *
+ * @hide
+ */
+@SystemApi
+public final class FloatSensorIndex {
+ private FloatSensorIndex() {}
+
+ public static final int CALCULATED_ENGINE_LOAD = 0;
+ public static final int ENGINE_COOLANT_TEMPERATURE = 1;
+ public static final int SHORT_TERM_FUEL_TRIM_BANK1 = 2;
+ public static final int LONG_TERM_FUEL_TRIM_BANK1 = 3;
+ public static final int SHORT_TERM_FUEL_TRIM_BANK2 = 4;
+ public static final int LONG_TERM_FUEL_TRIM_BANK2 = 5;
+ public static final int FUEL_PRESSURE = 6;
+ public static final int INTAKE_MANIFOLD_ABSOLUTE_PRESSURE = 7;
+ public static final int ENGINE_RPM = 8;
+ public static final int VEHICLE_SPEED = 9;
+ public static final int TIMING_ADVANCE = 10;
+ public static final int MAF_AIR_FLOW_RATE = 11;
+ public static final int THROTTLE_POSITION = 12;
+ public static final int OXYGEN_SENSOR1_VOLTAGE = 13;
+ public static final int OXYGEN_SENSOR1_SHORT_TERM_FUEL_TRIM = 14;
+ public static final int OXYGEN_SENSOR1_FUEL_AIR_EQUIVALENCE_RATIO = 15;
+ public static final int OXYGEN_SENSOR2_VOLTAGE = 16;
+ public static final int OXYGEN_SENSOR2_SHORT_TERM_FUEL_TRIM = 17;
+ public static final int OXYGEN_SENSOR2_FUEL_AIR_EQUIVALENCE_RATIO = 18;
+ public static final int OXYGEN_SENSOR3_VOLTAGE = 19;
+ public static final int OXYGEN_SENSOR3_SHORT_TERM_FUEL_TRIM = 20;
+ public static final int OXYGEN_SENSOR3_FUEL_AIR_EQUIVALENCE_RATIO = 21;
+ public static final int OXYGEN_SENSOR4_VOLTAGE = 22;
+ public static final int OXYGEN_SENSOR4_SHORT_TERM_FUEL_TRIM = 23;
+ public static final int OXYGEN_SENSOR4_FUEL_AIR_EQUIVALENCE_RATIO = 24;
+ public static final int OXYGEN_SENSOR5_VOLTAGE = 25;
+ public static final int OXYGEN_SENSOR5_SHORT_TERM_FUEL_TRIM = 26;
+ public static final int OXYGEN_SENSOR5_FUEL_AIR_EQUIVALENCE_RATIO = 27;
+ public static final int OXYGEN_SENSOR6_VOLTAGE = 28;
+ public static final int OXYGEN_SENSOR6_SHORT_TERM_FUEL_TRIM = 29;
+ public static final int OXYGEN_SENSOR6_FUEL_AIR_EQUIVALENCE_RATIO = 30;
+ public static final int OXYGEN_SENSOR7_VOLTAGE = 31;
+ public static final int OXYGEN_SENSOR7_SHORT_TERM_FUEL_TRIM = 32;
+ public static final int OXYGEN_SENSOR7_FUEL_AIR_EQUIVALENCE_RATIO = 33;
+ public static final int OXYGEN_SENSOR8_VOLTAGE = 34;
+ public static final int OXYGEN_SENSOR8_SHORT_TERM_FUEL_TRIM = 35;
+ public static final int OXYGEN_SENSOR8_FUEL_AIR_EQUIVALENCE_RATIO = 36;
+ public static final int FUEL_RAIL_PRESSURE = 37;
+ public static final int FUEL_RAIL_GAUGE_PRESSURE = 38;
+ public static final int COMMANDED_EXHAUST_GAS_RECIRCULATION = 39;
+ public static final int EXHAUST_GAS_RECIRCULATION_ERROR = 40;
+ public static final int COMMANDED_EVAPORATIVE_PURGE = 41;
+ public static final int FUEL_TANK_LEVEL_INPUT = 42;
+ public static final int EVAPORATION_SYSTEM_VAPOR_PRESSURE = 43;
+ public static final int CATALYST_TEMPERATURE_BANK1_SENSOR1 = 44;
+ public static final int CATALYST_TEMPERATURE_BANK2_SENSOR1 = 45;
+ public static final int CATALYST_TEMPERATURE_BANK1_SENSOR2 = 46;
+ public static final int CATALYST_TEMPERATURE_BANK2_SENSOR2 = 47;
+ public static final int ABSOLUTE_LOAD_VALUE = 48;
+ public static final int FUEL_AIR_COMMANDED_EQUIVALENCE_RATIO = 49;
+ public static final int RELATIVE_THROTTLE_POSITION = 50;
+ public static final int ABSOLUTE_THROTTLE_POSITION_B = 51;
+ public static final int ABSOLUTE_THROTTLE_POSITION_C = 52;
+ public static final int ACCELERATOR_PEDAL_POSITION_D = 53;
+ public static final int ACCELERATOR_PEDAL_POSITION_E = 54;
+ public static final int ACCELERATOR_PEDAL_POSITION_F = 55;
+ public static final int COMMANDED_THROTTLE_ACTUATOR = 56;
+ public static final int ETHANOL_FUEL_PERCENTAGE = 57;
+ public static final int ABSOLUTE_EVAPORATION_SYSTEM_VAPOR_PRESSURE = 58;
+ public static final int SHORT_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK1 = 59;
+ public static final int SHORT_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK2 = 60;
+ public static final int SHORT_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK3 = 61;
+ public static final int SHORT_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK4 = 62;
+ public static final int LONG_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK1 = 63;
+ public static final int LONG_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK2 = 64;
+ public static final int LONG_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK3 = 65;
+ public static final int LONG_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK4 = 66;
+ public static final int RELATIVE_ACCELERATOR_PEDAL_POSITION = 67;
+ public static final int HYBRID_BATTERY_PACK_REMAINING_LIFE = 68;
+ public static final int FUEL_INJECTION_TIMING = 69;
+ public static final int ENGINE_FUEL_RATE = 70;
+ public static final int LAST_SYSTEM = ENGINE_FUEL_RATE;
+ public static final int VENDOR_START = LAST_SYSTEM + 1;
+
+
+ /** @hide */
+ @Retention(RetentionPolicy.SOURCE)
+ @IntDef({
+ FloatSensorIndex.CALCULATED_ENGINE_LOAD,
+ FloatSensorIndex.ENGINE_COOLANT_TEMPERATURE,
+ FloatSensorIndex.SHORT_TERM_FUEL_TRIM_BANK1,
+ FloatSensorIndex.LONG_TERM_FUEL_TRIM_BANK1,
+ FloatSensorIndex.SHORT_TERM_FUEL_TRIM_BANK2,
+ FloatSensorIndex.LONG_TERM_FUEL_TRIM_BANK2,
+ FloatSensorIndex.FUEL_PRESSURE,
+ FloatSensorIndex.INTAKE_MANIFOLD_ABSOLUTE_PRESSURE,
+ FloatSensorIndex.ENGINE_RPM,
+ FloatSensorIndex.VEHICLE_SPEED,
+ FloatSensorIndex.TIMING_ADVANCE,
+ FloatSensorIndex.MAF_AIR_FLOW_RATE,
+ FloatSensorIndex.THROTTLE_POSITION,
+ FloatSensorIndex.OXYGEN_SENSOR1_VOLTAGE,
+ FloatSensorIndex.OXYGEN_SENSOR1_SHORT_TERM_FUEL_TRIM,
+ FloatSensorIndex.OXYGEN_SENSOR1_FUEL_AIR_EQUIVALENCE_RATIO,
+ FloatSensorIndex.OXYGEN_SENSOR2_VOLTAGE,
+ FloatSensorIndex.OXYGEN_SENSOR2_SHORT_TERM_FUEL_TRIM,
+ FloatSensorIndex.OXYGEN_SENSOR2_FUEL_AIR_EQUIVALENCE_RATIO,
+ FloatSensorIndex.OXYGEN_SENSOR3_VOLTAGE,
+ FloatSensorIndex.OXYGEN_SENSOR3_SHORT_TERM_FUEL_TRIM,
+ FloatSensorIndex.OXYGEN_SENSOR3_FUEL_AIR_EQUIVALENCE_RATIO,
+ FloatSensorIndex.OXYGEN_SENSOR4_VOLTAGE,
+ FloatSensorIndex.OXYGEN_SENSOR4_SHORT_TERM_FUEL_TRIM,
+ FloatSensorIndex.OXYGEN_SENSOR4_FUEL_AIR_EQUIVALENCE_RATIO,
+ FloatSensorIndex.OXYGEN_SENSOR5_VOLTAGE,
+ FloatSensorIndex.OXYGEN_SENSOR5_SHORT_TERM_FUEL_TRIM,
+ FloatSensorIndex.OXYGEN_SENSOR5_FUEL_AIR_EQUIVALENCE_RATIO,
+ FloatSensorIndex.OXYGEN_SENSOR6_VOLTAGE,
+ FloatSensorIndex.OXYGEN_SENSOR6_SHORT_TERM_FUEL_TRIM,
+ FloatSensorIndex.OXYGEN_SENSOR6_FUEL_AIR_EQUIVALENCE_RATIO,
+ FloatSensorIndex.OXYGEN_SENSOR7_VOLTAGE,
+ FloatSensorIndex.OXYGEN_SENSOR7_SHORT_TERM_FUEL_TRIM,
+ FloatSensorIndex.OXYGEN_SENSOR7_FUEL_AIR_EQUIVALENCE_RATIO,
+ FloatSensorIndex.OXYGEN_SENSOR8_VOLTAGE,
+ FloatSensorIndex.OXYGEN_SENSOR8_SHORT_TERM_FUEL_TRIM,
+ FloatSensorIndex.OXYGEN_SENSOR8_FUEL_AIR_EQUIVALENCE_RATIO,
+ FloatSensorIndex.FUEL_RAIL_PRESSURE,
+ FloatSensorIndex.FUEL_RAIL_GAUGE_PRESSURE,
+ FloatSensorIndex.COMMANDED_EXHAUST_GAS_RECIRCULATION,
+ FloatSensorIndex.EXHAUST_GAS_RECIRCULATION_ERROR,
+ FloatSensorIndex.COMMANDED_EVAPORATIVE_PURGE,
+ FloatSensorIndex.FUEL_TANK_LEVEL_INPUT,
+ FloatSensorIndex.EVAPORATION_SYSTEM_VAPOR_PRESSURE,
+ FloatSensorIndex.CATALYST_TEMPERATURE_BANK1_SENSOR1,
+ FloatSensorIndex.CATALYST_TEMPERATURE_BANK2_SENSOR1,
+ FloatSensorIndex.CATALYST_TEMPERATURE_BANK1_SENSOR2,
+ FloatSensorIndex.CATALYST_TEMPERATURE_BANK2_SENSOR2,
+ FloatSensorIndex.ABSOLUTE_LOAD_VALUE,
+ FloatSensorIndex.FUEL_AIR_COMMANDED_EQUIVALENCE_RATIO,
+ FloatSensorIndex.RELATIVE_THROTTLE_POSITION,
+ FloatSensorIndex.ABSOLUTE_THROTTLE_POSITION_B,
+ FloatSensorIndex.ABSOLUTE_THROTTLE_POSITION_C,
+ FloatSensorIndex.ACCELERATOR_PEDAL_POSITION_D,
+ FloatSensorIndex.ACCELERATOR_PEDAL_POSITION_E,
+ FloatSensorIndex.ACCELERATOR_PEDAL_POSITION_F,
+ FloatSensorIndex.COMMANDED_THROTTLE_ACTUATOR,
+ FloatSensorIndex.ETHANOL_FUEL_PERCENTAGE,
+ FloatSensorIndex.ABSOLUTE_EVAPORATION_SYSTEM_VAPOR_PRESSURE,
+ FloatSensorIndex.SHORT_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK1,
+ FloatSensorIndex.SHORT_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK2,
+ FloatSensorIndex.SHORT_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK3,
+ FloatSensorIndex.SHORT_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK4,
+ FloatSensorIndex.LONG_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK1,
+ FloatSensorIndex.LONG_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK2,
+ FloatSensorIndex.LONG_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK3,
+ FloatSensorIndex.LONG_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK4,
+ FloatSensorIndex.RELATIVE_ACCELERATOR_PEDAL_POSITION,
+ FloatSensorIndex.HYBRID_BATTERY_PACK_REMAINING_LIFE,
+ FloatSensorIndex.FUEL_INJECTION_TIMING,
+ FloatSensorIndex.ENGINE_FUEL_RATE,
+ FloatSensorIndex.LAST_SYSTEM,
+ FloatSensorIndex.VENDOR_START,
+ })
+ public @interface SensorIndex {}
+
+}
diff --git a/car-lib/src/android/car/hardware/IntegerSensorIndex.java b/car-lib/src/android/car/hardware/IntegerSensorIndex.java
new file mode 100644
index 0000000..70ed849
--- /dev/null
+++ b/car-lib/src/android/car/hardware/IntegerSensorIndex.java
@@ -0,0 +1,112 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * 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 android.car.hardware;
+
+import android.annotation.IntDef;
+import android.annotation.SystemApi;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * This class is a container for the indices of diagnostic sensors. The values are extracted by
+ * running packages/services/Car/tools/update-obd2-sensors.py against types.hal.
+ *
+ * DO NOT EDIT MANUALLY
+ *
+ * @hide
+ */
+@SystemApi
+public final class IntegerSensorIndex {
+ private IntegerSensorIndex() {}
+
+ public static final int FUEL_SYSTEM_STATUS = 0;
+ public static final int MALFUNCTION_INDICATOR_LIGHT_ON = 1;
+ public static final int IGNITION_MONITORS_SUPPORTED = 2;
+ public static final int IGNITION_SPECIFIC_MONITORS = 3;
+ public static final int INTAKE_AIR_TEMPERATURE = 4;
+ public static final int COMMANDED_SECONDARY_AIR_STATUS = 5;
+ public static final int NUM_OXYGEN_SENSORS_PRESENT = 6;
+ public static final int RUNTIME_SINCE_ENGINE_START = 7;
+ public static final int DISTANCE_TRAVELED_WITH_MALFUNCTION_INDICATOR_LIGHT_ON = 8;
+ public static final int WARMUPS_SINCE_CODES_CLEARED = 9;
+ public static final int DISTANCE_TRAVELED_SINCE_CODES_CLEARED = 10;
+ public static final int ABSOLUTE_BAROMETRIC_PRESSURE = 11;
+ public static final int CONTROL_MODULE_VOLTAGE = 12;
+ public static final int AMBIENT_AIR_TEMPERATURE = 13;
+ public static final int TIME_WITH_MALFUNCTION_LIGHT_ON = 14;
+ public static final int TIME_SINCE_TROUBLE_CODES_CLEARED = 15;
+ public static final int MAX_FUEL_AIR_EQUIVALENCE_RATIO = 16;
+ public static final int MAX_OXYGEN_SENSOR_VOLTAGE = 17;
+ public static final int MAX_OXYGEN_SENSOR_CURRENT = 18;
+ public static final int MAX_INTAKE_MANIFOLD_ABSOLUTE_PRESSURE = 19;
+ public static final int MAX_AIR_FLOW_RATE_FROM_MASS_AIR_FLOW_SENSOR = 20;
+ public static final int FUEL_TYPE = 21;
+ public static final int FUEL_RAIL_ABSOLUTE_PRESSURE = 22;
+ public static final int ENGINE_OIL_TEMPERATURE = 23;
+ public static final int DRIVER_DEMAND_PERCENT_TORQUE = 24;
+ public static final int ENGINE_ACTUAL_PERCENT_TORQUE = 25;
+ public static final int ENGINE_REFERENCE_PERCENT_TORQUE = 26;
+ public static final int ENGINE_PERCENT_TORQUE_DATA_IDLE = 27;
+ public static final int ENGINE_PERCENT_TORQUE_DATA_POINT1 = 28;
+ public static final int ENGINE_PERCENT_TORQUE_DATA_POINT2 = 29;
+ public static final int ENGINE_PERCENT_TORQUE_DATA_POINT3 = 30;
+ public static final int ENGINE_PERCENT_TORQUE_DATA_POINT4 = 31;
+ public static final int LAST_SYSTEM = ENGINE_PERCENT_TORQUE_DATA_POINT4;
+ public static final int VENDOR_START = LAST_SYSTEM + 1;
+
+
+ /** @hide */
+ @Retention(RetentionPolicy.SOURCE)
+ @IntDef({
+ IntegerSensorIndex.FUEL_SYSTEM_STATUS,
+ IntegerSensorIndex.MALFUNCTION_INDICATOR_LIGHT_ON,
+ IntegerSensorIndex.IGNITION_MONITORS_SUPPORTED,
+ IntegerSensorIndex.IGNITION_SPECIFIC_MONITORS,
+ IntegerSensorIndex.INTAKE_AIR_TEMPERATURE,
+ IntegerSensorIndex.COMMANDED_SECONDARY_AIR_STATUS,
+ IntegerSensorIndex.NUM_OXYGEN_SENSORS_PRESENT,
+ IntegerSensorIndex.RUNTIME_SINCE_ENGINE_START,
+ IntegerSensorIndex.DISTANCE_TRAVELED_WITH_MALFUNCTION_INDICATOR_LIGHT_ON,
+ IntegerSensorIndex.WARMUPS_SINCE_CODES_CLEARED,
+ IntegerSensorIndex.DISTANCE_TRAVELED_SINCE_CODES_CLEARED,
+ IntegerSensorIndex.ABSOLUTE_BAROMETRIC_PRESSURE,
+ IntegerSensorIndex.CONTROL_MODULE_VOLTAGE,
+ IntegerSensorIndex.AMBIENT_AIR_TEMPERATURE,
+ IntegerSensorIndex.TIME_WITH_MALFUNCTION_LIGHT_ON,
+ IntegerSensorIndex.TIME_SINCE_TROUBLE_CODES_CLEARED,
+ IntegerSensorIndex.MAX_FUEL_AIR_EQUIVALENCE_RATIO,
+ IntegerSensorIndex.MAX_OXYGEN_SENSOR_VOLTAGE,
+ IntegerSensorIndex.MAX_OXYGEN_SENSOR_CURRENT,
+ IntegerSensorIndex.MAX_INTAKE_MANIFOLD_ABSOLUTE_PRESSURE,
+ IntegerSensorIndex.MAX_AIR_FLOW_RATE_FROM_MASS_AIR_FLOW_SENSOR,
+ IntegerSensorIndex.FUEL_TYPE,
+ IntegerSensorIndex.FUEL_RAIL_ABSOLUTE_PRESSURE,
+ IntegerSensorIndex.ENGINE_OIL_TEMPERATURE,
+ IntegerSensorIndex.DRIVER_DEMAND_PERCENT_TORQUE,
+ IntegerSensorIndex.ENGINE_ACTUAL_PERCENT_TORQUE,
+ IntegerSensorIndex.ENGINE_REFERENCE_PERCENT_TORQUE,
+ IntegerSensorIndex.ENGINE_PERCENT_TORQUE_DATA_IDLE,
+ IntegerSensorIndex.ENGINE_PERCENT_TORQUE_DATA_POINT1,
+ IntegerSensorIndex.ENGINE_PERCENT_TORQUE_DATA_POINT2,
+ IntegerSensorIndex.ENGINE_PERCENT_TORQUE_DATA_POINT3,
+ IntegerSensorIndex.ENGINE_PERCENT_TORQUE_DATA_POINT4,
+ IntegerSensorIndex.LAST_SYSTEM,
+ IntegerSensorIndex.VENDOR_START,
+ })
+ public @interface SensorIndex {}
+
+}
diff --git a/tests/carservice_test/src/com/android/car/test/CarDiagnosticManagerTest.java b/tests/carservice_test/src/com/android/car/test/CarDiagnosticManagerTest.java
index b21197a..dfdc9df 100644
--- a/tests/carservice_test/src/com/android/car/test/CarDiagnosticManagerTest.java
+++ b/tests/carservice_test/src/com/android/car/test/CarDiagnosticManagerTest.java
@@ -27,8 +27,8 @@
import android.car.hardware.CarDiagnosticEvent.SparkIgnitionMonitors;
import android.car.hardware.CarDiagnosticEvent.SecondaryAirStatus;
import android.car.hardware.CarDiagnosticManager;
-import android.car.hardware.CarDiagnosticSensorIndices.FloatSensorIndex;
-import android.car.hardware.CarDiagnosticSensorIndices.IntegerSensorIndex;
+import android.car.hardware.FloatSensorIndex;
+import android.car.hardware.IntegerSensorIndex;
import android.hardware.automotive.vehicle.V2_0.VehiclePropValue;
import android.hardware.automotive.vehicle.V2_1.VehicleProperty;
import android.os.SystemClock;
diff --git a/tools/update-obd2-sensors.py b/tools/update-obd2-sensors.py
index 02acbc9..6528b16 100755
--- a/tools/update-obd2-sensors.py
+++ b/tools/update-obd2-sensors.py
@@ -109,17 +109,46 @@
str(sensorId) + ";"
def prefix(self, theSensors):
- s = " public static final class %sSensorIndex {\n" % \
- theSensors.descriptor
- s += " private %sSensorIndex() {}\n" % \
- theSensors.descriptor
+ s = \
+"/*\n" + \
+" * Copyright (C) 2017 The Android Open Source Project\n" + \
+" *\n" + \
+" * Licensed under the Apache License, Version 2.0 (the \"License\");\n" + \
+" * you may not use this file except in compliance with the License.\n" + \
+" * You may obtain a copy of the License at\n" + \
+" *\n" + \
+" * http://www.apache.org/licenses/LICENSE-2.0\n" + \
+" *\n" + \
+" * Unless required by applicable law or agreed to in writing, software\n" + \
+" * distributed under the License is distributed on an \"AS IS\" BASIS,\n" + \
+" * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" + \
+" * See the License for the specific language governing permissions and\n" + \
+" * limitations under the License.\n" + \
+"*/\n" + \
+"\n" + \
+"package android.car.hardware;\n" + \
+"\n" + \
+"import android.annotation.IntDef;\n" + \
+"import android.annotation.SystemApi;\n" + \
+"import java.lang.annotation.Retention;\n" + \
+"import java.lang.annotation.RetentionPolicy;\n" + \
+"\n" + \
+"/**\n" + \
+" * This class is a container for the indices of diagnostic sensors. The values are extracted by\n" + \
+" * running packages/services/Car/tools/update-obd2-sensors.py against types.hal.\n" + \
+" *\n" + \
+" * DO NOT EDIT MANUALLY\n" + \
+" *\n" + \
+" * @hide\n" + \
+" */\n" + \
+"@SystemApi\n" + \
+"public final class %sSensorIndex {\n" % theSensors.descriptor + \
+" private %sSensorIndex() {}\n" % theSensors.descriptor
+
return s
- def suffix(self, theSensors):
- return " }"
-
def indent(self):
- return 8
+ return 4
class PythonSensorPolicy(SensorPolicy):
"""The sensor policy that emits Python sensor descriptions."""
@@ -141,14 +170,13 @@
return "%sSensorIndex.%s," % (theSensors.descriptor,sensorName)
def prefix(self, theSensors):
- return " @Retention(RetentionPolicy.SOURCE)\n @IntDef({"
+ return " /** @hide */\n @Retention(RetentionPolicy.SOURCE)\n @IntDef({"
def indent(self):
return 8
def suffix(self, theSensors):
- return " })\n public @interface Diagnostic%sSensorIndex {}" % \
- theSensors.descriptor
+ return " })\n public @interface SensorIndex {}"
class SensorMeta(type):
"""Metaclass for sensor classes."""
@@ -182,7 +210,15 @@
def applyPolicy(policy, destfile):
"""Given a sensor policy, apply it to all known sensor types"""
+ applyIntPolicy(policy, destfile)
+ applyFloatPolicy(policy, destfile)
+
+def applyIntPolicy(policy, destfile):
+ "Given a sensor policy, apply it to integer sensors"
print(policy.sensors(intSensors), file=destfile)
+
+def applyFloatPolicy(policy, destfile):
+ "Given a sensor policy, apply it to float sensors"
print(policy.sensors(floatSensors), file=destfile)
def java(destfile):
@@ -196,43 +232,18 @@
def generateJava(filepath):
"""Generate Java code for all sensors."""
- destfile = open(filepath, "w")
- print("/*", file=destfile)
- print(" * Copyright (C) 2017 The Android Open Source Project", file=destfile)
- print(" *", file=destfile)
- print(" * Licensed under the Apache License, Version 2.0 (the \"License\");", file=destfile)
- print(" * you may not use this file except in compliance with the License.", file=destfile)
- print(" * You may obtain a copy of the License at", file=destfile)
- print(" *", file=destfile)
- print(" * http://www.apache.org/licenses/LICENSE-2.0", file=destfile)
- print(" *", file=destfile)
- print(" * Unless required by applicable law or agreed to in writing, software", file=destfile)
- print(" * distributed under the License is distributed on an \"AS IS\" BASIS,", file=destfile)
- print(" * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", file=destfile)
- print(" * See the License for the specific language governing permissions and", file=destfile)
- print(" * limitations under the License.", file=destfile)
- print("*/", file=destfile)
- print("", file=destfile)
- print("package android.car.hardware;", file=destfile)
- print("", file=destfile)
- print("import android.annotation.IntDef;", file=destfile)
- print("import android.annotation.SystemApi;", file=destfile)
- print("import java.lang.annotation.Retention;", file=destfile)
- print("import java.lang.annotation.RetentionPolicy;", file=destfile)
- print("", file=destfile)
- print("/**", file=destfile)
- print(" * This class is a container for the indices of integer and float diagnostic sensors.", file=destfile)
- print(" * These values are extracted from types.hal by packages/services/Car/tools/update-obd2-sensors.py", file=destfile)
- print(" *", file=destfile)
- print(" * DO NOT EDIT MANUALLY", file=destfile)
- print(" *", file=destfile)
- print(" * @hide", file=destfile)
- print(" */", file=destfile)
- print("@SystemApi", file=destfile)
- print("public final class CarDiagnosticSensorIndices {", file=destfile)
- java(destfile)
- intdef(destfile)
- print("}", file=destfile)
+ intfile = open(os.path.join(filepath, "IntegerSensorIndex.java"), "w")
+ floatfile = open(os.path.join(filepath, "FloatSensorIndex.java"), "w")
+ javaPolicy = JavaSensorPolicy()
+ intdefPolicy = IntDefSensorPolicy()
+ applyIntPolicy(javaPolicy, intfile)
+ applyIntPolicy(intdefPolicy, intfile)
+ applyFloatPolicy(javaPolicy, floatfile)
+ applyFloatPolicy(intdefPolicy, floatfile)
+ print("}", file=intfile)
+ print("}", file=floatfile)
+ intfile.close()
+ floatfile.close()
def generatePython(filepath):
"""Generate Python code for all sensors."""
@@ -270,7 +281,7 @@
import os
if len(sys.argv) != 4:
- print('syntax: update-obd2-sensors.py <path/to/types.hal> <path/to/CarDiagnosticSensorIndices.java> <path/to/diagnostic_sensors.py>')
+ print('syntax: update-obd2-sensors.py <path/to/types.hal> <path/to/*SensorIndices.java> <path/to/diagnostic_sensors.py>')
print('This script will parse types.hal, and use the resulting', end='')
print('parse tree to generate CarDiagnosticSensorIndices.java.')
sys.exit(1)