From d84109482013f5d0920f87636861f070f04c7a80 Mon Sep 17 00:00:00 2001 From: Steve Paik Date: Tue, 6 Jun 2017 10:24:53 -0700 Subject: [PATCH] Add support of generating fake events via emulator Bug: 62358398 Test: Python scripts can enable fake events Change-Id: Id933ae59fc4d763572b88f58367a3aef0af52b6b --- .../impl/vhal_v2_0/EmulatedVehicleHal.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.cpp index fe34a3f610..4800cd8054 100644 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.cpp +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.cpp @@ -61,10 +61,11 @@ VehicleHal::VehiclePropValuePtr EmulatedVehicleHal::get( StatusCode EmulatedVehicleHal::set(const VehiclePropValue& propValue) { if (propValue.prop == kGenerateFakeDataControllingProperty) { - return handleGenerateFakeDataRequest(propValue); - }; - - if (mHvacPowerProps.count(propValue.prop)) { + StatusCode status = handleGenerateFakeDataRequest(propValue); + if (status != StatusCode::OK) { + return status; + } + } else if (mHvacPowerProps.count(propValue.prop)) { auto hvacPowerOn = mPropStore->readValueOrNull(toInt(VehicleProperty::HVAC_POWER_ON), toInt(VehicleAreaZone::ROW_1)); @@ -176,6 +177,13 @@ bool EmulatedVehicleHal::isContinuousProperty(int32_t propId) const { } bool EmulatedVehicleHal::setPropertyFromVehicle(const VehiclePropValue& propValue) { + if (propValue.prop == kGenerateFakeDataControllingProperty) { + StatusCode status = handleGenerateFakeDataRequest(propValue); + if (status != StatusCode::OK) { + return false; + } + } + if (mPropStore->writeValue(propValue)) { doHalEvent(getValuePool()->obtain(propValue)); return true;