Teach Vehicle HAL a way to indicate which subset of OBD2 sensors are valid for a given frame.
We are now using the "bytes" element of VehiclePropValue::RawValue as a storage place for a bitmask that indicates
which sensor indices, among those defined, actually map to valid values in the int32Values and floatValues respectively.
Test: make vts BUILD_GOOGLE_VTS=true -j32 && vts-tradefed run commandAndExit vts --skip-all-system-status-check --primary-abi-only --skip-preconditions --module VehicleHidlTest -l INFO
Test: adb root && adb push out/target/product/bat/data/nativetest/android.hardware.vehicle@2.0-manager-unit-tests/android.hardware.vehicle@2.0-manager-unit-tests /data/nativetest/android.hardware.vehicle@2.0-manager-unit-tests/android.hardware.vehicle@2.0-manager-unit-tests && adb shell /data/nativetest/android.hardware.vehicle@2.0-manager-unit-tests/android.hardware.vehicle@2.0-manager-unit-tests | grep Obd2
Change-Id: I4e9a116555001d2577d50d50009f75d8f78603b0
diff --git a/vehicle/2.0/default/impl/DefaultVehicleHal.h b/vehicle/2.0/default/impl/DefaultVehicleHal.h
index 15a4789..165324e 100644
--- a/vehicle/2.0/default/impl/DefaultVehicleHal.h
+++ b/vehicle/2.0/default/impl/DefaultVehicleHal.h
@@ -17,8 +17,11 @@
#ifndef android_hardware_vehicle_V2_0_impl_DefaultVehicleHal_H_
#define android_hardware_vehicle_V2_0_impl_DefaultVehicleHal_H_
+#include <memory>
+
#include <VehicleHal.h>
#include <impl/DefaultConfig.h>
+#include <vehicle_hal_manager/Obd2SensorStore.h>
#include <utils/SystemClock.h>
namespace android {
@@ -38,6 +41,8 @@
VehiclePropValuePtr get(const VehiclePropValue& requestedPropValue,
StatusCode* outStatus) override;
+ void onCreate() override;
+
StatusCode set(const VehiclePropValue& propValue) override;
StatusCode subscribe(VehicleProperty property,
@@ -57,8 +62,8 @@
StatusCode setHvacTemperature(int32_t areaId, float value);
StatusCode getHvacDefroster(int32_t areaId, bool* outValue);
StatusCode setHvacDefroster(int32_t areaId, bool value);
- StatusCode fillObd2LiveFrame (VehiclePropValuePtr* v);
- StatusCode fillObd2FreezeFrame (VehiclePropValuePtr* v);
+ StatusCode fillObd2LiveFrame(VehiclePropValuePtr* v);
+ StatusCode fillObd2FreezeFrame(VehiclePropValuePtr* v);
private:
int32_t mFanSpeed = 3;
int32_t mBrightness = 7;
@@ -71,6 +76,7 @@
bool mHvacAcOn = true;
bool mHvacAutoOn = true;
VehicleHvacFanDirection mFanDirection = VehicleHvacFanDirection::FACE;
+ std::unique_ptr<Obd2SensorStore> mObd2SensorStore{nullptr};
};
} // impl