Loading automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.cpp +35 −0 Original line number Diff line number Diff line Loading @@ -156,6 +156,29 @@ StatusCode EmulatedVehicleHal::set(const VehiclePropValue& propValue) { // Placeholder for future implementation of VMS property in the default hal. For // now, just returns OK; otherwise, hal clients crash with property not supported. return StatusCode::OK; case AP_POWER_STATE_REPORT: switch (propValue.value.int32Values[0]) { case toInt(VehicleApPowerStateReport::DEEP_SLEEP_EXIT): case toInt(VehicleApPowerStateReport::SHUTDOWN_CANCELLED): case toInt(VehicleApPowerStateReport::WAIT_FOR_VHAL): // CPMS is in WAIT_FOR_VHAL state, simply move to ON doHalEvent(createApPowerStateReq(VehicleApPowerStateReq::ON, 0)); break; case toInt(VehicleApPowerStateReport::DEEP_SLEEP_ENTRY): case toInt(VehicleApPowerStateReport::SHUTDOWN_START): // CPMS is in WAIT_FOR_FINISH state, send the FINISHED command doHalEvent(createApPowerStateReq(VehicleApPowerStateReq::FINISHED, 0)); break; case toInt(VehicleApPowerStateReport::ON): case toInt(VehicleApPowerStateReport::SHUTDOWN_POSTPONE): case toInt(VehicleApPowerStateReport::SHUTDOWN_PREPARE): // Do nothing break; default: // Unknown state break; } break; } } Loading Loading @@ -401,6 +424,18 @@ StatusCode EmulatedVehicleHal::handleGenerateFakeDataRequest(const VehiclePropVa return StatusCode::OK; } VehicleHal::VehiclePropValuePtr EmulatedVehicleHal::createApPowerStateReq( VehicleApPowerStateReq state, int32_t param) { auto req = getValuePool()->obtain(VehiclePropertyType::INT32_VEC, 2); req->prop = toInt(VehicleProperty::AP_POWER_STATE_REQ); req->areaId = 0; req->timestamp = elapsedRealtimeNano(); req->status = VehiclePropertyStatus::AVAILABLE; req->value.int32Values[0] = toInt(state); req->value.int32Values[1] = param; return req; } VehicleHal::VehiclePropValuePtr EmulatedVehicleHal::createHwInputKeyProp( VehicleHwKeyInputAction action, int32_t keyCode, int32_t targetDisplay) { auto keyEvent = getValuePool()->obtain(VehiclePropertyType::INT32_VEC, 3); Loading automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.h +1 −0 Original line number Diff line number Diff line Loading @@ -67,6 +67,7 @@ private: StatusCode handleGenerateFakeDataRequest(const VehiclePropValue& request); void onFakeValueGenerated(const VehiclePropValue& value); VehiclePropValuePtr createApPowerStateReq(VehicleApPowerStateReq req, int32_t param); VehiclePropValuePtr createHwInputKeyProp(VehicleHwKeyInputAction action, int32_t keyCode, int32_t targetDisplay); Loading Loading
automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.cpp +35 −0 Original line number Diff line number Diff line Loading @@ -156,6 +156,29 @@ StatusCode EmulatedVehicleHal::set(const VehiclePropValue& propValue) { // Placeholder for future implementation of VMS property in the default hal. For // now, just returns OK; otherwise, hal clients crash with property not supported. return StatusCode::OK; case AP_POWER_STATE_REPORT: switch (propValue.value.int32Values[0]) { case toInt(VehicleApPowerStateReport::DEEP_SLEEP_EXIT): case toInt(VehicleApPowerStateReport::SHUTDOWN_CANCELLED): case toInt(VehicleApPowerStateReport::WAIT_FOR_VHAL): // CPMS is in WAIT_FOR_VHAL state, simply move to ON doHalEvent(createApPowerStateReq(VehicleApPowerStateReq::ON, 0)); break; case toInt(VehicleApPowerStateReport::DEEP_SLEEP_ENTRY): case toInt(VehicleApPowerStateReport::SHUTDOWN_START): // CPMS is in WAIT_FOR_FINISH state, send the FINISHED command doHalEvent(createApPowerStateReq(VehicleApPowerStateReq::FINISHED, 0)); break; case toInt(VehicleApPowerStateReport::ON): case toInt(VehicleApPowerStateReport::SHUTDOWN_POSTPONE): case toInt(VehicleApPowerStateReport::SHUTDOWN_PREPARE): // Do nothing break; default: // Unknown state break; } break; } } Loading Loading @@ -401,6 +424,18 @@ StatusCode EmulatedVehicleHal::handleGenerateFakeDataRequest(const VehiclePropVa return StatusCode::OK; } VehicleHal::VehiclePropValuePtr EmulatedVehicleHal::createApPowerStateReq( VehicleApPowerStateReq state, int32_t param) { auto req = getValuePool()->obtain(VehiclePropertyType::INT32_VEC, 2); req->prop = toInt(VehicleProperty::AP_POWER_STATE_REQ); req->areaId = 0; req->timestamp = elapsedRealtimeNano(); req->status = VehiclePropertyStatus::AVAILABLE; req->value.int32Values[0] = toInt(state); req->value.int32Values[1] = param; return req; } VehicleHal::VehiclePropValuePtr EmulatedVehicleHal::createHwInputKeyProp( VehicleHwKeyInputAction action, int32_t keyCode, int32_t targetDisplay) { auto keyEvent = getValuePool()->obtain(VehiclePropertyType::INT32_VEC, 3); Loading
automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.h +1 −0 Original line number Diff line number Diff line Loading @@ -67,6 +67,7 @@ private: StatusCode handleGenerateFakeDataRequest(const VehiclePropValue& request); void onFakeValueGenerated(const VehiclePropValue& value); VehiclePropValuePtr createApPowerStateReq(VehicleApPowerStateReq req, int32_t param); VehiclePropValuePtr createHwInputKeyProp(VehicleHwKeyInputAction action, int32_t keyCode, int32_t targetDisplay); Loading