Functions
Tango Service: Lifecycle Interface

Functions for initializing, shutting down, and resetting the Tango Service. More...

Functions

TangoErrorType TangoService_connect (void *context, TangoConfig config)
void TangoService_disconnect ()
TangoConfig TangoService_getConfig (TangoConfigType config_type)
TangoErrorType TangoService_initialize (void *jni_env, void *activity)
void TangoService_resetMotionTracking ()
TangoErrorType TangoService_setBinder (void *jni_env, void *iBinder)
TangoErrorType TangoService_setRuntimeConfig (TangoConfig tconfig)

Detailed Description

Functions for initializing, shutting down, and resetting the Tango Service.


Function Documentation

TangoErrorType TangoService_connect ( void *  context,
TangoConfig  config 
)

Sets the configuration of the Tango Service and starts it running. The service will connect with the specified configuration, or the default configuration if none is provided. TangoService_connect() starts the motion estimation and at that point you can query the Tango Service for data (such as camera, depth, or pose), via direct calls or callbacks. When the service starts, it uses the TangoConfig specified by config; you can free it after the call completes.

Parameters:
contextOptional. A user defined pointer that is returned in callback functions onPoseAvailable, onPointCloudAvailable and onTangoEvent. If set to NULL then an additional argument can be passed to onPoseAvailable, onPointCloudAvailable and onTangoEvent to optionally set individual callback contexts.
configThe service will be started with the setting specified by this TangoConfig handle. If NULL is passed here, then the service will be started in the default configuration.
Returns:
TANGO_SUCCESS on successfully starting the configuration. Returns TANGO_ERROR on failure, or if the camera could not be opened which could be due to cameras being opened by other applications or could be caused by a system error which may require a reboot. Returns TANGO_INVALID if an Area Description UUID was specified but could not be found or accessed by the service, or if the provided combination of config flags is not valid. Returns TANGO_NO_DATASET_PERMISSION if the config_enable_dataset_recording flag was enabled, but the user has not given permissions to read and write datasets. Returns TANGO_NO_LOCATION_PERMISSION if the calling app does not have the ACCESS_FINE_LOCATION Android permission and cloud ADFs are being used.

Disconnects from the Tango Service. Callbacks will no longer be generated or provide sensor data. Applications should always call TangoService_disconnect() when the service is no longer needed. When you call this function, all previous configuration data is invalidated.

Creates a TangoConfig object with configuration settings from the service. This should be used to initialize a Config object for setting the configuration that TangoService should be run in. The Config handle is passed to TangoService_connect() which starts the service running with the parameters set at that time in that TangoConfig handle. This function can be used to find the current configuration of the service (i.e. what would be run if no config is specified on TangoService_connect()), or to create one of a few "template" TangoConfigs. The returned TangoConfig can be further modified by TangoConfig_set function calls. The handle should be freed with TangoConfig_free(). The handle is needed only at the time of TangoService_connect() where it is used to configure the service, and can safely be freed after it has been used in TangoService_connect().

Parameters:
config_typeThe requested configuration type.
Returns:
A handle (TangoConfig*) for a newly allocated TangoConfig object with settings as requested by config_type. Returns NULL if the config_type is not valid, the config could not be allocated, the service could not be initialized, or an internal failure occurred.
TangoErrorType TangoService_initialize ( void *  jni_env,
void *  activity 
)
Deprecated:
This function is implicitly called when needed.

Initialize the Tango Service. To succeed, the calling application must have camera permissions enabled. The initialization is invalidated if the service is stopped or faults while a client is running. TangoService_initialize() uses two parameters, the JNI context, env, and the native activity object, activity, to check that the version of Tango Service installed on the device meets the minimum number required by the client library. The parameters env and activity may be retrieved in a native activity for example by:

 void android_main(struct android_app* state) {
   JNIEnv* env;
   JavaVM* m_vm = state->activity->vm;
   (*m_vm)->AttachCurrentThread(m_vm, &env, NULL);
   jobject activity = state->activity->clazz;
   TangoService_initialize(env, activity);
 }
Parameters:
jni_envA pointer to the JNI Context of the native activity. This must be of type JNIEnv*, and implicit type conversion should do the right thing without requiring a cast.
activityThe native activity object handle of the calling native activity. This should be of type jobject, and implicit type conversion should do the right thing without requiring a cast.
Returns:
TANGO_SUCCESS if a the Tango Service version is found to be compatible with this client's library version and the service was initialized successfully; TANGO_INVALID if either the env and/or activity parameter is set to null; TANGO_ERROR if the version check fails, or if the service connection could not be initialized.

Resets the motion tracking system. This reinitializes the TANGO_COORDINATE_FRAME_START_OF_SERVICE coordinate frame to where the device is when you call this function; afterwards, if you ask for the pose with relation to start of service, it uses this as the new origin. You can call this function at any time.

If you are using Area Learning, the TANGO_COORDINATE_FRAME_AREA_DESCRIPTION coordinate frame is not affected by calling this function; however, the device needs to localize again before you can use the area description.

TangoErrorType TangoService_setBinder ( void *  jni_env,
void *  iBinder 
)

Completes initialization of TangoService by allowing the client to pass the native binder object received by binding to TangoService back down to the underlying C API code. Must be called before trying to use the C API.

Parameters:
jni_envA pointer to the JNI Context of the native activity. This must be of type JNIEnv*, and implicit type conversion should do the right thing without requiring a cast.
iBinderThe binder object received after binding to TangoService. This should be of type jobject, and implicit type conversion should do the right thing without requiring a cast.
Returns:
TANGO_SUCCESS on successfully attaching the binder to the C API; TANGO_ERROR on failure.

Sets configuration parameters at runtime. Only configuration parameters prefixed config_runtime_ are settable with this and others are ignored. Must be called after TangoService_connect(), on a running system.

Parameters:
tconfigThe service will be configured while running to the newly specified setting.
Returns:
TANGO_SUCCESS on successfully reconfiguring the service. Returns TANGO_INVALID if the app has not connected to the service, in which case no changes are made, or if tconfig is NULL. Returns TANGO_ERROR on failure or if the service was not found on the device.


tango_client_api
Author(s):
autogenerated on Thu Jun 6 2019 19:49:49