Add vehicle HAL mocking with carsystem and carsystemtest API
- System API and system test API for testing only added. Client
should link only one of them.
- vehicle HAL mocking allows mocking vehicle HAL completely.
- Once mocking is started, for now, all previous states are forgotton,
so stopping mocking does not return to original state. It is
better to simply restart framework after test.
- Added skeleton code for audio focus handling. Detailed implementaiton
will be added later.
bug: 24874617
Change-Id: I6e60daab3dc96769a94acc09a695f8f49dbb8536
(cherry picked from commit a32e24f50d5895a94d3a13d6ec2233af6e43dac5)
diff --git a/libvehiclenetwork/tool/vehiclehal_code_gen.py b/libvehiclenetwork/tool/vehiclehal_code_gen.py
index 72b9ab3..8f64e9b 100755
--- a/libvehiclenetwork/tool/vehiclehal_code_gen.py
+++ b/libvehiclenetwork/tool/vehiclehal_code_gen.py
@@ -117,7 +117,6 @@
}
}
"""
-
#now implement getVehiclePropertyName
print \
"""public static String getVehiclePropertyName(int property) {
@@ -130,6 +129,34 @@
}
}
"""
+ #now implement getVehicleChangeMode
+ print \
+"""public static int[] getVehicleChangeMode(int property) {
+switch (property) {"""
+ for p in props:
+ if p.changeMode != "":
+ modes = p.changeMode.split('|')
+ modesString = []
+ for m in modes:
+ modesString.append("VehiclePropChangeMode." + m)
+ print "case " + p.name + ": return new int[] { " + " , ".join(modesString) + " };"
+ print \
+"""default: return null;
+}
+}
+"""
+ #now implement getVehicleAccess
+ print \
+"""public static int getVehicleAccess(int property) {
+switch (property) {"""
+ for p in props:
+ if p.access != "":
+ print "case " + p.name + ": return VehiclePropAccess." + p.access + ";"
+ print \
+"""default: return 0;
+}
+}
+"""
def printEnum(e):
print "public static class " + toJavaStyleName(e.name) + " {"
@@ -189,7 +216,7 @@
prop.access = words[i]
elif words[i] == "@unit":
i += 1
- prop.changeMode = words[i]
+ prop.unit = words[i]
elif words[i] == "@range_start" or words[i] == "@range_end":
prop.startEnd = 1
i += 1