Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | - | - | ||||
README.md | D | 03-May-2024 | 2.7 KiB | 85 | 62 | |
VehicleHalProto_pb2.py | D | 03-May-2024 | 25.6 KiB | 608 | 568 | |
__init__.py | D | 03-May-2024 | 0 | 1 | 0 | |
diagjson.example | D | 03-May-2024 | 165.5 KiB | 12,012 | 12,011 | |
diagnostic_builder.py | D | 03-May-2024 | 3.2 KiB | 90 | 56 | |
diagnostic_injector.py | D | 03-May-2024 | 4.4 KiB | 120 | 78 | |
diagnostic_sensors.py | D | 03-May-2024 | 7.2 KiB | 132 | 107 | |
driving_info_generator.py | D | 03-May-2024 | 9.2 KiB | 232 | 163 | |
gui.py | D | 03-May-2024 | 4.5 KiB | 147 | 95 | |
obd2_to_diagjson.py | D | 03-May-2024 | 7.1 KiB | 229 | 162 | |
prop_event_simulator.py | D | 03-May-2024 | 2.8 KiB | 92 | 74 | |
user_action_generator.py | D | 03-May-2024 | 7.9 KiB | 220 | 167 | |
vhal_const_generate.py | D | 03-May-2024 | 5.7 KiB | 128 | 84 | |
vhal_consts_2_0.py | D | 03-May-2024 | 32.4 KiB | 787 | 644 | |
vhal_emulator.py | D | 03-May-2024 | 10.2 KiB | 270 | 195 | |
vhal_emulator_test.py | D | 03-May-2024 | 17.1 KiB | 378 | 272 | |
vhal_prop_simulator.py | D | 03-May-2024 | 2.4 KiB | 70 | 40 |
README.md
1# VHAL Host Emulator 2This is a collection of python modules as tools for VHAL development. 3 4[TOC] 5 6## vhal_emulator.py 7This allow you to create script to interate with the Vehicle HAL in an AAOS 8device from a host. 9 10* It sends and receives messages to/from the Vehicle HAL via port forwarding 11over ADB to communicate with the AAOS device. 12* On the device side, VHAL module VehicleService creates VehicleEmulator to 13setup SocketComm to serve the requests. 14 * hardware/interfaces/automotive/vehicle/2.0/default/VehicleService.cpp 15 * hardware/interfaces/automotive/vehicle/2.0/default/impl/vhal_v2_0/VehicleEmulator.cpp 16 * hardware/interfaces/automotive/vehicle/2.0/default/impl/vhal_v2_0/SocketComm.cpp 17* vhal_emulator_test.py tests the Vehicle HAL via adb socket. 18 * Note: This may outdated becuase there is no dedicated resrouce. Contribution is welcome. 19 20## vhal_const_generate.py 21This generates vhal_consts_2_0.py to update definitions for property ID, value 22type, zone, etc. from the types.hal. Run this script whenever types.hal is 23changed. 24 25* Must re-generate when the types.hal file changes. 26 27``` 28packages/services/Car/tools/emulator/vhal_const_generate.py 29``` 30 31* hardware/interfaces/automotive/vehicle/2.0/types.hal 32 33## VehicleHalProto_pb2.py 34This defines message interface to VHAL Emulator from VehicleHalProto.proto. 35 36* Must re-generate whenever the proto file changes. 37* Generated from hardware/interfaces/automotive/vehicle/2.0/default/impl/vhal_v2_0/proto/VehicleHalProto.proto 38 39``` 40protoDir=$ANDROID_BUILD_TOP/hardware/interfaces/automotive/vehicle/2.0/default/impl/vhal_v2_0/proto 41outDir=$ANDROID_BUILD_TOP/packages/services/Car/tools/emulator 42# or protoc if perferred 43aprotoc -I=$protoDir --python_out=$outDir $protoDir/VehicleHalProto.proto 44 45``` 46 47* It requires Protocol Buffers. You may build one from Android, e.g. 48 49``` 50. build/envsetup.sh 51lunch sdk_gcar_x86-userdebug 52m aprotoc -j16 53``` 54 55 56## OBD2 Diagnostic Injector 57These scripts are useful for testing the Diagnostics API 58 59### diagnostic_builder.py 60 61* Helper class used by diagnostic_injector.py 62* Stores diagnostic sensor values and bitmasks 63* VehiclePropValue-compatible 64 65### diagnostic_injector.py 66 67* Deserializes JSON into diagnostic events 68* Sends over HAL Emulator Interface 69* Diagnostic JSON Format example: diagjson.example 70 71``` 72./diagnostic_injector.py ./diagjson.example 73``` 74 75## Python GUI Example 76gui.py is an example to create an GUI to set the property. 77 78* packages/services/Car/tools/emulator/gui.py 79* GUI runs on host machine (PyQt4-based widgets) 80* Drives VHAL on target 81 * Works only with default VHAL 82 * Interactions generate SET messages 83* Supports bench testing of apps 84* Easy to add support for more properties 85