aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Randolph <randolphs@google.com>2017-06-01 15:34:19 -0700
committerScott Randolph <randolphs@google.com>2017-06-06 18:09:51 -0700
commit639213989db8620f0186533c0f65696378e4c249 (patch)
tree691ab877ecd7be8d8ef8b4134b995882c3eedbc2
parentc9d80ac4dcd5d23559ab373693e1e4bfffc245a9 (diff)
downloadCar-639213989db8620f0186533c0f65696378e4c249.tar.gz
Add command line options for EVS manager and app
Allow specification of the hardware enumerator service id to which the manager should connect on startup. Test: build and run manager and app on gordon_peak Change-Id: Ia989e333d9405b707e4b9b16b46b866539a1a626
-rw-r--r--evs/app/evs_app.cpp10
-rw-r--r--evs/manager/ServiceNames.h9
-rw-r--r--evs/manager/service.cpp35
3 files changed, 48 insertions, 6 deletions
diff --git a/evs/app/evs_app.cpp b/evs/app/evs_app.cpp
index 9d33e05174..5f8d64f652 100644
--- a/evs/app/evs_app.cpp
+++ b/evs/app/evs_app.cpp
@@ -74,6 +74,7 @@ int main(int argc, char** argv)
// Set up default behavior, then check for command line options
bool useVehicleHal = true;
+ bool printHelp = false;
const char* evsServiceName = "default";
for (int i=1; i< argc; i++) {
if (strcmp(argv[i], "--test") == 0) {
@@ -82,10 +83,19 @@ int main(int argc, char** argv)
evsServiceName = "EvsEnumeratorHw";
} else if (strcmp(argv[i], "--mock") == 0) {
evsServiceName = "EvsEnumeratorHw-Mock";
+ } else if (strcmp(argv[i], "--help") == 0) {
+ printHelp = true;
} else {
printf("Ignoring unrecognized command line arg '%s'\n", argv[i]);
+ printHelp = true;
}
}
+ if (printHelp) {
+ printf("Options include:\n");
+ printf(" --test Do not talk to Vehicle Hal, but simulate 'reverse' instead\n");
+ printf(" --hw Bypass EvsManager by connecting directly to EvsEnumeratorHw\n");
+ printf(" --mock Connect directly to EvsEnumeratorHw-Mock\n");
+ }
// Load our configuration information
ConfigManager config;
diff --git a/evs/manager/ServiceNames.h b/evs/manager/ServiceNames.h
index 46705a9b19..fb875364ee 100644
--- a/evs/manager/ServiceNames.h
+++ b/evs/manager/ServiceNames.h
@@ -18,7 +18,10 @@
// This is the name as which we'll register ourselves
const static char kManagedEnumeratorName[] = "default";
-// This is the name of the hardware provider to which we'll bind
-// TODO: How should we configure these values to target appropriate hardware?
-const static char kHardwareEnumeratorName[] = "EvsEnumeratorHw-Mock";
+// This is the name of the hardware provider to which we'll bind by default
+const static char kHardwareEnumeratorName[] = "EvsEnumeratorHw";
+
+// This is the name of the mock hardware provider selectable via command line.
+// (should match .../hardware/interfaces/automotive/evs/1.0/default/ServiceNames.h)
+const static char kMockEnumeratorName[] = "EvsEnumeratorHw-Mock";
diff --git a/evs/manager/service.cpp b/evs/manager/service.cpp
index b3b6e9a4e3..fe1136b956 100644
--- a/evs/manager/service.cpp
+++ b/evs/manager/service.cpp
@@ -40,14 +40,43 @@ using namespace android::automotive::evs::V1_0::implementation;
using namespace android;
-int main() {
+int main(int argc, char** argv) {
+ ALOGI("EVS manager starting\n");
+
+ // Set up default behavior, then check for command line options
+ bool printHelp = false;
+ const char* evsHardwareServiceName = kHardwareEnumeratorName;
+ for (int i=1; i< argc; i++) {
+ if (strcmp(argv[i], "--mock") == 0) {
+ evsHardwareServiceName = kMockEnumeratorName;
+ } else if (strcmp(argv[i], "--target") == 0) {
+ i++;
+ if (i >= argc) {
+ ALOGE("--target <service> was not provided with a service name\n");
+ } else {
+ evsHardwareServiceName = argv[i];
+ }
+ } else if (strcmp(argv[i], "--help") == 0) {
+ printHelp = true;
+ } else {
+ printf("Ignoring unrecognized command line arg '%s'\n", argv[i]);
+ printHelp = true;
+ }
+ }
+ if (printHelp) {
+ printf("Options include:\n");
+ printf(" --mock Connect to the mock driver at EvsEnumeratorHw-Mock\n");
+ printf(" --target <service_name> Connect to the named IEvsEnumerator service");
+ }
+
+
// Prepare the RPC serving thread pool. We're configuring it with no additional
// threads beyond the main thread which will "join" the pool below.
configureRpcThreadpool(1, true /* callerWillJoin */);
- ALOGI("EVS managed service connecting to hardware at %s", kHardwareEnumeratorName);
+ ALOGI("EVS managed service connecting to hardware service at %s", evsHardwareServiceName);
android::sp<Enumerator> service = new Enumerator();
- if (!service->init(kHardwareEnumeratorName)) {
+ if (!service->init(evsHardwareServiceName)) {
ALOGE("Failed to initialize");
return 1;
}