• Home
Name Date Size #Lines LOC

..--

README.mdD03-May-20242.7 KiB8562

VehicleHalProto_pb2.pyD03-May-202425.6 KiB608568

__init__.pyD03-May-20240 10

diagjson.exampleD03-May-2024165.5 KiB12,01212,011

diagnostic_builder.pyD03-May-20243.2 KiB9056

diagnostic_injector.pyD03-May-20244.4 KiB12078

diagnostic_sensors.pyD03-May-20247.2 KiB132107

driving_info_generator.pyD03-May-20249.2 KiB232163

gui.pyD03-May-20244.5 KiB14795

obd2_to_diagjson.pyD03-May-20247.1 KiB229162

prop_event_simulator.pyD03-May-20242.8 KiB9274

user_action_generator.pyD03-May-20247.9 KiB220167

vhal_const_generate.pyD03-May-20245.7 KiB12884

vhal_consts_2_0.pyD03-May-202432.4 KiB787644

vhal_emulator.pyD03-May-202410.2 KiB270195

vhal_emulator_test.pyD03-May-202417.1 KiB378272

vhal_prop_simulator.pyD03-May-20242.4 KiB7040

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