vnc: Initial binder service
Use aidl-cpp to generate binder boilerplate from an initial
interface description. This will allow configuring the service
from within Android.
diff --git a/src/main.cpp b/src/main.cpp
index 8ef24fb..e1e8ac1 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -19,7 +19,10 @@
#include <csignal>
#include <iostream>
+#include <binder/IServiceManager.h>
+
#include "VNCFlinger.h"
+#include "VNCService.h"
using namespace android;
@@ -84,7 +87,7 @@
case '4':
arg = optarg;
- if (gVNC->setListenAddress(arg, false) != OK) {
+ if (gVNC->setV4Address(arg) != OK) {
std::cerr << "Failed to set IPv4 address\n";
exit(1);
}
@@ -92,14 +95,13 @@
case '6':
arg = optarg;
- if (gVNC->setListenAddress(arg, true) != OK) {
+ if (gVNC->setV6Address(arg) != OK) {
std::cerr << "Failed to set IPv6 address\n";
exit(1);
}
break;
case 'p':
- std::cerr << "port=" << optarg << std::endl;
if (gVNC->setPort(std::stoi(optarg)) != OK) {
std::cerr << "Failed to set port\n";
exit(1);
@@ -127,5 +129,8 @@
parseArgs(argc, argv);
+ // binder interface
+ defaultServiceManager()->addService(String16("vnc"), new VNCService(gVNC));
+
gVNC->start();
}