Loading automotive/vehicle/TEST_MAPPING +3 −0 Original line number Diff line number Diff line Loading @@ -14,6 +14,9 @@ }, { "name": "FakeVehicleHalValueGeneratorsTest" }, { "name": "FakeObd2FrameTest" } ] } automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/Android.bp +4 −1 Original line number Diff line number Diff line Loading @@ -25,7 +25,10 @@ cc_library { local_include_dirs: ["include"], export_include_dirs: ["include"], defaults: ["VehicleHalDefaults"], static_libs: ["VehicleHalUtils"], static_libs: [ "VehicleHalUtils", "FakeObd2Frame", ], shared_libs: [ "libjsoncpp", ], Loading automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/src/JsonFakeValueGenerator.cpp +5 −13 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ #include <type_traits> #include <typeinfo> #include <Obd2SensorStore.h> #include <VehicleUtils.h> #include <android/binder_enums.h> #include <utils/Log.h> Loading @@ -42,16 +43,6 @@ using ::aidl::android::hardware::automotive::vehicle::VehicleProperty; using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType; using ::aidl::android::hardware::automotive::vehicle::VehiclePropValue; template <class T> int getLastIndex() { auto range = ::ndk::enum_range<T>(); auto it = range.begin(); while (std::next(it) != range.end()) { it++; } return toInt(*it); } bool isDiagnosticProperty(int32_t prop) { return prop == toInt(VehicleProperty::OBD2_LIVE_FRAME) || prop == toInt(VehicleProperty::OBD2_FREEZE_FRAME); Loading Loading @@ -84,9 +75,10 @@ void copyMixedValueJson(const Json::Value& jsonValue, RawPropValues& dest) { } std::vector<uint8_t> generateDiagnosticBytes(const RawPropValues& diagnosticValue) { size_t lastIntegerSensorIndex = static_cast<size_t>(getLastIndex<DiagnosticIntegerSensorIndex>()); size_t lastFloatSensorIndex = static_cast<size_t>(getLastIndex<DiagnosticFloatSensorIndex>()); size_t lastIntegerSensorIndex = static_cast<size_t>( obd2frame::Obd2SensorStore::getLastIndex<DiagnosticIntegerSensorIndex>()); size_t lastFloatSensorIndex = static_cast<size_t>( obd2frame::Obd2SensorStore::getLastIndex<DiagnosticFloatSensorIndex>()); size_t byteSize = (lastIntegerSensorIndex + lastFloatSensorIndex + 2); std::vector<uint8_t> bytes((byteSize + 7) / 8); Loading automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/test/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ cc_test { static_libs: [ "VehicleHalUtils", "FakeVehicleHalValueGenerators", "FakeObd2Frame", ], shared_libs: [ "libjsoncpp", Loading automotive/vehicle/aidl/impl/fake_impl/obd2frame/Android.bp 0 → 100644 +32 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 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 { default_applicable_licenses: ["Android-Apache-2.0"], } cc_library { name: "FakeObd2Frame", vendor: true, srcs: ["src/*.cpp"], local_include_dirs: ["include"], export_include_dirs: ["include"], defaults: ["VehicleHalDefaults"], static_libs: [ "VehicleHalUtils", ], export_static_lib_headers: ["VehicleHalUtils"], } Loading
automotive/vehicle/TEST_MAPPING +3 −0 Original line number Diff line number Diff line Loading @@ -14,6 +14,9 @@ }, { "name": "FakeVehicleHalValueGeneratorsTest" }, { "name": "FakeObd2FrameTest" } ] }
automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/Android.bp +4 −1 Original line number Diff line number Diff line Loading @@ -25,7 +25,10 @@ cc_library { local_include_dirs: ["include"], export_include_dirs: ["include"], defaults: ["VehicleHalDefaults"], static_libs: ["VehicleHalUtils"], static_libs: [ "VehicleHalUtils", "FakeObd2Frame", ], shared_libs: [ "libjsoncpp", ], Loading
automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/src/JsonFakeValueGenerator.cpp +5 −13 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ #include <type_traits> #include <typeinfo> #include <Obd2SensorStore.h> #include <VehicleUtils.h> #include <android/binder_enums.h> #include <utils/Log.h> Loading @@ -42,16 +43,6 @@ using ::aidl::android::hardware::automotive::vehicle::VehicleProperty; using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType; using ::aidl::android::hardware::automotive::vehicle::VehiclePropValue; template <class T> int getLastIndex() { auto range = ::ndk::enum_range<T>(); auto it = range.begin(); while (std::next(it) != range.end()) { it++; } return toInt(*it); } bool isDiagnosticProperty(int32_t prop) { return prop == toInt(VehicleProperty::OBD2_LIVE_FRAME) || prop == toInt(VehicleProperty::OBD2_FREEZE_FRAME); Loading Loading @@ -84,9 +75,10 @@ void copyMixedValueJson(const Json::Value& jsonValue, RawPropValues& dest) { } std::vector<uint8_t> generateDiagnosticBytes(const RawPropValues& diagnosticValue) { size_t lastIntegerSensorIndex = static_cast<size_t>(getLastIndex<DiagnosticIntegerSensorIndex>()); size_t lastFloatSensorIndex = static_cast<size_t>(getLastIndex<DiagnosticFloatSensorIndex>()); size_t lastIntegerSensorIndex = static_cast<size_t>( obd2frame::Obd2SensorStore::getLastIndex<DiagnosticIntegerSensorIndex>()); size_t lastFloatSensorIndex = static_cast<size_t>( obd2frame::Obd2SensorStore::getLastIndex<DiagnosticFloatSensorIndex>()); size_t byteSize = (lastIntegerSensorIndex + lastFloatSensorIndex + 2); std::vector<uint8_t> bytes((byteSize + 7) / 8); Loading
automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/test/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ cc_test { static_libs: [ "VehicleHalUtils", "FakeVehicleHalValueGenerators", "FakeObd2Frame", ], shared_libs: [ "libjsoncpp", Loading
automotive/vehicle/aidl/impl/fake_impl/obd2frame/Android.bp 0 → 100644 +32 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 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 { default_applicable_licenses: ["Android-Apache-2.0"], } cc_library { name: "FakeObd2Frame", vendor: true, srcs: ["src/*.cpp"], local_include_dirs: ["include"], export_include_dirs: ["include"], defaults: ["VehicleHalDefaults"], static_libs: [ "VehicleHalUtils", ], export_static_lib_headers: ["VehicleHalUtils"], }