Revert^2 "Add a command line option for the test mode"
f3892674fb1da933518f8a669f572316d419df76
Bug: 163641719
Bug: 168307765
Test: Run adb shell evs_app --test --gear park
Change-Id: Ie3f2a0bb884ae137929392aaf9abd744bc3eeb72
Merged-In: I4f801ad035083b4a016b7f9b4f80e2c09003d6d1
diff --git a/evs/apps/default/ConfigManager.h b/evs/apps/default/ConfigManager.h
index 7c2186d..eb89770 100644
--- a/evs/apps/default/ConfigManager.h
+++ b/evs/apps/default/ConfigManager.h
@@ -111,6 +111,8 @@
android_pixel_format_t getExternalMemoryFormat() const {
return mExternalMemoryFormat;
}
+ void setMockGearSignal(int32_t signal) { mMockGearSignal = signal; }
+ int32_t getMockGearSignal() const { return mMockGearSignal; }
private:
// Camera information
@@ -126,6 +128,9 @@
// Format of external memory
android_pixel_format_t mExternalMemoryFormat;
+ // Gear signal to simulate in test mode
+ int32_t mMockGearSignal;
+
// Car body information (assumes front wheel steering and origin at center of rear axel)
// Note that units aren't specified and don't matter as long as all length units are consistent
// within the JSON file from which we parse. That is, if everything is in meters, that's fine.
diff --git a/evs/apps/default/EvsStateControl.cpp b/evs/apps/default/EvsStateControl.cpp
index 06af502..5e81022 100644
--- a/evs/apps/default/EvsStateControl.cpp
+++ b/evs/apps/default/EvsStateControl.cpp
@@ -219,7 +219,7 @@
bool EvsStateControl::selectStateForCurrentConditions() {
- static int32_t sDummyGear = int32_t(VehicleGear::GEAR_REVERSE);
+ static int32_t sDummyGear = mConfig.getMockGearSignal();
static int32_t sDummySignal = int32_t(VehicleTurnSignal::NONE);
if (mVehicle != nullptr) {
@@ -245,7 +245,7 @@
sDummyGear = int32_t(VehicleGear::GEAR_DRIVE);
}
- // Build the dummy vehicle state values (treating single values as 1 element vectors)
+ // Build the placeholder vehicle state values (treating single values as 1 element vectors)
mGearValue.value.int32Values.setToExternal(&sDummyGear, 1);
mTurnSignalValue.value.int32Values.setToExternal(&sDummySignal, 1);
}
diff --git a/evs/apps/default/config.json b/evs/apps/default/config.json
index a8f200f..81c96ae 100644
--- a/evs/apps/default/config.json
+++ b/evs/apps/default/config.json
@@ -19,8 +19,8 @@
}
],
"graphic" : {
- "frontPixel" : 23,
- "rearPixel" : 223
+ "frontPixel" : -20,
+ "rearPixel" : 260
},
"cameras" : [
{
diff --git a/evs/apps/default/evs_app.cpp b/evs/apps/default/evs_app.cpp
index 92d4b7a..877304e 100644
--- a/evs/apps/default/evs_app.cpp
+++ b/evs/apps/default/evs_app.cpp
@@ -133,6 +133,7 @@
int displayId = -1;
bool useExternalMemory = false;
android_pixel_format_t extMemoryFormat = HAL_PIXEL_FORMAT_RGBA_8888;
+ int32_t mockGearSignal = static_cast<int32_t>(VehicleGear::GEAR_REVERSE);
for (int i=1; i< argc; i++) {
if (strcmp(argv[i], "--test") == 0) {
useVehicleHal = false;
@@ -159,6 +160,15 @@
++i;
}
}
+ } else if (strcmp(argv[i], "--gear") == 0) {
+ // Gear signal to simulate
+ i += 1; // increase an index to next argument
+ if (strcasecmp(argv[i], "Park") == 0) {
+ mockGearSignal = static_cast<int32_t>(VehicleGear::GEAR_PARK);
+ } else if (strcasecmp(argv[i], "Reverse") != 0) {
+ LOG(WARNING) << "Unknown gear signal, " << argv[i] << ", is ignored "
+ << "and the reverse signal will be used instead";
+ }
} else {
printf("Ignoring unrecognized command line arg '%s'\n", argv[i]);
printHelp = true;
@@ -166,7 +176,10 @@
}
if (printHelp) {
printf("Options include:\n");
- printf(" --test\n\tDo not talk to Vehicle Hal, but simulate 'reverse' instead\n");
+ printf(" --test\n\tDo not talk to Vehicle Hal, "
+ "but simulate a given mock gear signal instead\n");
+ printf(" --gear\n\tMock gear signal for the test mode.");
+ printf(" Available options are Reverse and Park (case insensitive)\n");
printf(" --hw\n\tBypass EvsManager by connecting directly to EvsEnumeratorHw\n");
printf(" --mock\n\tConnect directly to EvsEnumeratorHw-Mock\n");
printf(" --display\n\tSpecify the display to use. If this is not set, the first"
@@ -230,6 +243,9 @@
config.useExternalMemory(useExternalMemory);
config.setExternalMemoryFormat(extMemoryFormat);
+ // Set a mock gear signal for the test mode
+ config.setMockGearSignal(mockGearSignal);
+
// Connect to the Vehicle HAL so we can monitor state
sp<IVehicle> pVnet;
if (useVehicleHal) {