1 #include <android/binder_process.h>
2 #include <utils/Errors.h>
3 #include <utils/Log.h>
4 
5 #include <iostream>
6 #include <thread>
7 
8 #include "RouterSvc.h"
9 
10 using namespace android::automotive::computepipe::router::V1_0::implementation;
11 
12 static RouterSvc gSvcInstance;
13 
14 #define SVC_NAME() gSvcInstance.getSvcName().c_str()
15 
startService()16 static void startService() {
17     auto status = gSvcInstance.initSvc();
18     if (status != router::Error::OK) {
19         ALOGE("Could not register service %s", SVC_NAME());
20         exit(2);
21     }
22     ALOGE("Registration Complete");
23 }
24 
main(int argc,char ** argv)25 int main(int argc, char** argv) {
26     auto status = gSvcInstance.parseArgs(argc - 1, &argv[1]);
27     if (status != router::Error::OK) {
28         ALOGE("Bad Args");
29         exit(2);
30     }
31     ABinderProcess_startThreadPool();
32     std::thread registrationThread(startService);
33     ABinderProcess_joinThreadPool();
34     ALOGE("Router thread joined IPC pool");
35     return 1;
36 }
37