17 package eu.intermodalics.nodelet_manager;
19 import android.app.Activity;
20 import android.content.ComponentName;
21 import android.content.Context;
22 import android.content.Intent;
23 import android.content.ServiceConnection;
24 import android.os.IBinder;
25 import android.util.Log;
78 ServiceConnection connection) {
81 Intent intent =
new Intent();
82 intent.setClassName(
"com.google.tango",
"com.google.atap.tango.TangoService");
84 boolean hasJavaService = (activity.getPackageManager().resolveService(intent, 0) != null);
87 if (!hasJavaService) {
88 intent =
new Intent();
89 intent.setClassName(
"com.projecttango.tango",
"com.google.atap.tango.TangoService");
90 hasJavaService = (activity.getPackageManager().resolveService(intent, 0) != null);
96 if (!hasJavaService) {
100 return activity.bindService(intent, connection, Context.BIND_AUTO_CREATE);
108 ServiceConnection connection) {
109 context.unbindService(connection);
110 mIsTangoServiceBound =
false;
121 String basePath =
"/data/data/com.google.tango/libfiles/";
122 if (!(
new File(basePath).
exists())) {
123 basePath =
"/data/data/com.projecttango.tango/libfiles/";
125 Log.i(
"TangoInitializationHelp",
"basePath: " + basePath);
128 System.load(basePath +
"arm64-v8a/libtango_client_api.so");
130 Log.i(
"TangoInitializationHelp",
"Success! Using arm64-v8a/libtango_client_api.");
131 }
catch (UnsatisfiedLinkError e) {
132 Log.e(
"TangoInitializationHelp", e.toString());
134 if (loadedSoId < ARCH_DEFAULT) {
136 System.load(basePath +
"armeabi-v7a/libtango_client_api.so");
138 Log.i(
"TangoInitializationHelp",
"Success! Using armeabi-v7a/libtango_client_api.");
139 }
catch (UnsatisfiedLinkError e) {
140 Log.e(
"TangoInitializationHelp", e.toString());
143 if (loadedSoId < ARCH_DEFAULT) {
145 System.load(basePath +
"x86_64/libtango_client_api.so");
147 Log.i(
"TangoInitializationHelp",
"Success! Using x86_64/libtango_client_api.");
148 }
catch (UnsatisfiedLinkError e) {
149 Log.e(
"TangoInitializationHelp", e.toString());
152 if (loadedSoId < ARCH_DEFAULT) {
154 System.load(basePath +
"x86/libtango_client_api.so");
156 Log.i(
"TangoInitializationHelp",
"Success! Using x86/libtango_client_api.");
157 }
catch (UnsatisfiedLinkError e) {
158 Log.e(
"TangoInitializationHelp", e.toString());
161 if (loadedSoId < ARCH_DEFAULT) {
163 System.load(basePath +
"default/libtango_client_api.so");
165 Log.i(
"TangoInitializationHelp",
"Success! Using default/libtango_client_api.");
166 }
catch (UnsatisfiedLinkError e) {
167 Log.e(
"TangoInitializationHelp", e.toString());
170 if (loadedSoId < ARCH_DEFAULT) {
172 System.loadLibrary(
"tango_client_api");
174 Log.i(
"TangoInitializationHelp",
"Falling back to libtango_client_api.so symlink.");
175 }
catch (UnsatisfiedLinkError e) {
176 Log.e(
"TangoInitializationHelp", e.toString());
192 }
catch (Exception e) {
239 connectionErrorCallback = callback;
251 if (connectionErrorCallback != null) {
252 connectionErrorCallback.
execute();
static final int ARCH_FALLBACK
static final int ARCH_DEFAULT
void onServiceDisconnected(ComponentName name)
static final boolean bindTangoService(final Activity activity, ServiceConnection connection)
static final int ARCH_X86_64
static final String DEFAULT_LIB_NAME
static final int ARCH_X86
static final int loadTangoSharedLibrary()
static boolean mIsTangoServiceBound
static boolean isTangoServiceBound()
static ServiceConnection NewDefaultServiceConnection(DefaultTangoServiceConnection.AfterConnectionCallback callback)
static boolean mIsTangoVersionOk
void onServiceConnected(ComponentName name, IBinder service)
static final void unbindTangoService(final Context context, ServiceConnection connection)
static final int ARCH_ARM64
static final int loadTangoRosNodeSharedLibrary()
static ServiceConnection NewDefaultServiceConnection()
static native boolean setBinderTangoService(IBinder nativeTangoServiceBinder)
static boolean testTangoVersionOk(Activity activity)
DefaultTangoServiceConnection(AfterConnectionCallback callback)
static final int ARCH_ARM32
static boolean isTangoVersionOk()
ROSCPP_DECL bool exists(const std::string &service_name, bool print_failure_reason)
AfterConnectionCallback connectionErrorCallback
static final int ARCH_ERROR