00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef TANGO_CLIENT_API_HEADER_TANGO_CLIENT_API_H_
00015 #define TANGO_CLIENT_API_HEADER_TANGO_CLIENT_API_H_
00016
00017 #include <stdbool.h>
00018 #include <stddef.h>
00019 #include <stdint.h>
00020
00023
00027
00029 typedef enum {
00030 TANGO_CAMERA_COLOR = 0,
00031 TANGO_CAMERA_RGBIR,
00032 TANGO_CAMERA_FISHEYE,
00033 TANGO_CAMERA_DEPTH,
00034 TANGO_MAX_CAMERA_ID
00035 } TangoCameraId;
00036
00038 typedef enum {
00039 TANGO_CONFIG_DEFAULT = 0,
00040 TANGO_CONFIG_CURRENT,
00041 TANGO_CONFIG_MOTION_TRACKING,
00042 TANGO_CONFIG_AREA_LEARNING,
00043 TANGO_CONFIG_RUNTIME,
00044 TANGO_MAX_CONFIG_TYPE
00045 } TangoConfigType;
00046
00048 typedef enum {
00053 TANGO_COORDINATE_FRAME_GLOBAL_WGS84 = 0,
00055 TANGO_COORDINATE_FRAME_AREA_DESCRIPTION,
00057 TANGO_COORDINATE_FRAME_START_OF_SERVICE,
00059 TANGO_COORDINATE_FRAME_PREVIOUS_DEVICE_POSE,
00060 TANGO_COORDINATE_FRAME_DEVICE,
00061 TANGO_COORDINATE_FRAME_IMU,
00062 TANGO_COORDINATE_FRAME_DISPLAY,
00063 TANGO_COORDINATE_FRAME_CAMERA_COLOR,
00064 TANGO_COORDINATE_FRAME_CAMERA_DEPTH,
00065 TANGO_COORDINATE_FRAME_CAMERA_FISHEYE,
00066 TANGO_COORDINATE_FRAME_UUID,
00067 TANGO_COORDINATE_FRAME_INVALID,
00068 TANGO_MAX_COORDINATE_FRAME_TYPE
00069 } TangoCoordinateFrameType;
00070
00074 typedef enum {
00076 TANGO_NO_LOCATION_PERMISSION = -8,
00078 TANGO_NO_DATASET_PERMISSION = -7,
00080 TANGO_NO_IMPORT_EXPORT_PERMISSION = -6,
00082 TANGO_NO_CAMERA_PERMISSION = -5,
00084 TANGO_NO_ADF_PERMISSION = -4,
00087 TANGO_NO_MOTION_TRACKING_PERMISSION = -3,
00089 TANGO_INVALID = -2,
00091 TANGO_ERROR = -1,
00093 TANGO_SUCCESS = 0,
00094 } TangoErrorType;
00095
00103 typedef enum {
00104 TANGO_POSE_INITIALIZING = 0,
00105 TANGO_POSE_VALID,
00106 TANGO_POSE_INVALID,
00107 TANGO_POSE_UNKNOWN
00108 } TangoPoseStatusType;
00109
00111
00112
00113 typedef enum {
00114 TANGO_EVENT_UNKNOWN = 0,
00115 TANGO_EVENT_GENERAL,
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125 TANGO_EVENT_FISHEYE_CAMERA,
00126
00127
00128 TANGO_EVENT_COLOR_CAMERA,
00129
00130
00131 TANGO_EVENT_IMU,
00132
00133 TANGO_EVENT_FEATURE_TRACKING,
00134
00135 TANGO_EVENT_AREA_LEARNING,
00136
00137 TANGO_EVENT_CLOUD_ADF,
00138
00139
00140
00141 } TangoEventType;
00142
00145 typedef enum {
00146 TANGO_CALIBRATION_UNKNOWN,
00150 TANGO_CALIBRATION_EQUIDISTANT,
00153 TANGO_CALIBRATION_POLYNOMIAL_2_PARAMETERS,
00156 TANGO_CALIBRATION_POLYNOMIAL_3_PARAMETERS,
00159 TANGO_CALIBRATION_POLYNOMIAL_5_PARAMETERS,
00160 } TangoCalibrationType;
00161
00166 typedef enum {
00167 TANGO_HAL_PIXEL_FORMAT_RGBA_8888 = 1,
00168 TANGO_HAL_PIXEL_FORMAT_YV12 = 0x32315659,
00169 TANGO_HAL_PIXEL_FORMAT_YCrCb_420_SP = 0x11
00170 } TangoImageFormatType;
00171
00173 typedef enum {
00177 TANGO_POINTCLOUD_XYZIJ = -1,
00179 TANGO_POINTCLOUD_XYZC = 0
00180 } TangoDepthMode;
00181
00184 typedef enum {
00186 TANGO_RECORDING_MODE_UNKNOWN = -1,
00188 TANGO_RECORDING_MODE_MOTION_TRACKING = 0,
00190 TANGO_RECORDING_MODE_SCENE_RECONSTRUCTION = 1,
00192 TANGO_RECORDING_MODE_MOTION_TRACKING_AND_FISHEYE = 2,
00194 TANGO_RECORDING_MODE_ALL = 3
00195 } TangoRecordingMode_Experimental;
00196
00199 typedef enum {
00202 TANGO_RUNTIME_RECORDING_NO_CHANGE = 0,
00204 TANGO_RUNTIME_RECORDING_START = 1,
00206 TANGO_RUNTIME_RECORDING_STOP = 2
00207 } TangoRuntimeRecordingControl_Experimental;
00208
00211
00212
00213
00214
00217 typedef void* TangoConfig;
00218
00219 #define TANGO_UUID_LEN 37
00220 #define TANGO_COORDINATE_FRAME_ID_LEN 37
00221 #define TANGO_LEVEL_SHORT_NAME_BYTE_MAX_LEN 16
00222 #define TANGO_LEVEL_ID_BYTE_MAX_LEN 19
00223
00227 typedef char TangoUUID[TANGO_UUID_LEN];
00228
00229
00230
00231
00232
00233 typedef struct TangoCoordinateFrameId {
00234
00235 char data[TANGO_COORDINATE_FRAME_ID_LEN];
00236 } TangoCoordinateFrameId;
00237
00238
00239
00240 const TangoCoordinateFrameId TANGO_COORDINATE_FRAME_ID_NONE = {
00241 "10000000-0000-0000-0000-0000000000ff"};
00242 const TangoCoordinateFrameId TANGO_COORDINATE_FRAME_ID_GLOBAL_WGS84 = {
00243 "10000000-0000-0000-0000-000000000000"};
00244 const TangoCoordinateFrameId TANGO_COORDINATE_FRAME_ID_AREA_DESCRIPTION = {
00245 "10000000-0000-0000-0000-000000000001"};
00246 const TangoCoordinateFrameId TANGO_COORDINATE_FRAME_ID_START_OF_SERVICE = {
00247 "10000000-0000-0000-0000-000000000002"};
00248 const TangoCoordinateFrameId TANGO_COORDINATE_FRAME_ID_PREVIOUS_DEVICE_POSE = {
00249 "10000000-0000-0000-0000-000000000003"};
00250 const TangoCoordinateFrameId TANGO_COORDINATE_FRAME_ID_DEVICE = {
00251 "10000000-0000-0000-0000-000000000004"};
00252 const TangoCoordinateFrameId TANGO_COORDINATE_FRAME_ID_IMU = {
00253 "10000000-0000-0000-0000-000000000005"};
00254 const TangoCoordinateFrameId TANGO_COORDINATE_FRAME_ID_DISPLAY = {
00255 "10000000-0000-0000-0000-000000000006"};
00256 const TangoCoordinateFrameId TANGO_COORDINATE_FRAME_ID_CAMERA_COLOR = {
00257 "10000000-0000-0000-0000-000000000007"};
00258 const TangoCoordinateFrameId TANGO_COORDINATE_FRAME_ID_CAMERA_DEPTH = {
00259 "10000000-0000-0000-0000-000000000008"};
00260 const TangoCoordinateFrameId TANGO_COORDINATE_FRAME_ID_CAMERA_FISHEYE = {
00261 "10000000-0000-0000-0000-000000000009"};
00262
00265 typedef void* TangoAreaDescriptionMetadata;
00266
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285 typedef struct {
00291 TangoCoordinateFrameType base;
00292
00296 TangoCoordinateFrameType target;
00297 } TangoCoordinateFramePair;
00298
00305 typedef struct TangoPoseData {
00307 uint32_t version;
00308
00310 double timestamp;
00311
00321 double orientation[4];
00322
00325 double translation[3];
00327 TangoPoseStatusType status_code;
00331 TangoCoordinateFramePair frame;
00332 uint32_t confidence;
00333 float accuracy;
00334 } TangoPoseData;
00335
00338 typedef struct TangoTransformation {
00348 double orientation[4];
00349
00352 double translation[3];
00353 } TangoTransformation;
00354
00357 typedef struct TangoImageBuffer {
00359 uint32_t width;
00361 uint32_t height;
00363 uint32_t stride;
00365 double timestamp;
00367 int64_t frame_number;
00369 TangoImageFormatType format;
00371 uint8_t* data;
00373 int64_t exposure_duration_ns;
00374 } TangoImageBuffer;
00375
00382 #define TANGO_MAX_IMAGE_PLANES (4)
00383 typedef struct TangoImage {
00385 uint32_t width;
00387 uint32_t height;
00389 TangoImageFormatType format;
00391 int64_t timestamp_ns;
00392
00394 uint32_t num_planes;
00396 uint8_t* plane_data[TANGO_MAX_IMAGE_PLANES];
00398 int32_t plane_size[TANGO_MAX_IMAGE_PLANES];
00400 int32_t plane_row_stride[TANGO_MAX_IMAGE_PLANES];
00402 int32_t plane_pixel_stride[TANGO_MAX_IMAGE_PLANES];
00403 } TangoImage;
00404
00409 typedef struct TangoCameraMetadata {
00411 int64_t timestamp_ns;
00413 int64_t frame_number;
00415 int64_t exposure_duration_ns;
00416 } TangoCameraMetadata;
00417
00421 typedef struct TangoXYZij {
00423 uint32_t version;
00424
00426 double timestamp;
00427
00432 uint32_t xyz_count;
00433
00442 float (*xyz)[3];
00443
00445 uint32_t ij_rows;
00447 uint32_t ij_cols;
00448
00458 uint32_t* ij;
00459
00461 TangoImageBuffer* color_image;
00462 } TangoXYZij;
00463
00465 typedef struct TangoPointCloud {
00467 uint32_t version;
00468
00470 double timestamp;
00471
00475 uint32_t num_points;
00476
00483 float (*points)[4];
00484 } TangoPointCloud;
00485
00525 typedef struct TangoCameraIntrinsics {
00527 TangoCameraId camera_id;
00530 TangoCalibrationType calibration_type;
00531
00533 uint32_t width;
00535 uint32_t height;
00536
00538 double fx;
00540 double fy;
00542 double cx;
00544 double cy;
00545
00548 double distortion[5];
00549 } TangoCameraIntrinsics;
00550
00573 typedef struct TangoEvent {
00575 double timestamp;
00577 TangoEventType type;
00579 const char* event_key;
00581 const char* event_value;
00582 } TangoEvent;
00583
00584 #ifdef __cplusplus
00585 extern "C" {
00586 #endif
00587
00594
00598 void TangoConfig_free(TangoConfig config);
00599
00604 char* TangoConfig_toString(TangoConfig config);
00605
00608
00609
00610
00611
00612
00645 TangoErrorType TangoService_initialize(void* jni_env, void* activity);
00646
00662 TangoErrorType TangoService_setBinder(void* jni_env, void* iBinder);
00663
00682 TangoConfig TangoService_getConfig(TangoConfigType config_type);
00683
00710 TangoErrorType TangoService_connect(void* context, TangoConfig config);
00711
00722 TangoErrorType TangoService_setRuntimeConfig(TangoConfig tconfig);
00723
00728 void TangoService_disconnect();
00729
00740 void TangoService_resetMotionTracking();
00741
00744
00745
00746
00747
00769 TangoErrorType TangoService_connectOnPoseAvailable(
00770 uint32_t count, const TangoCoordinateFramePair* frames,
00771 void (*TangoService_onPoseAvailable)(void* context,
00772 const TangoPoseData* pose),
00773 ...);
00774
00803 TangoErrorType TangoService_getPoseAtTime(double timestamp,
00804 TangoCoordinateFramePair frame,
00805 TangoPoseData* pose);
00806
00809
00810
00811
00812
00826 TangoErrorType TangoService_connectOnXYZijAvailable(
00827 void (*TangoService_onXYZijAvailable)(void* context,
00828 const TangoXYZij* xyz_ij),
00829 ...);
00830
00841 TangoErrorType TangoService_connectOnPointCloudAvailable(
00842 void (*TangoService_onPointCloudAvailable)(void* context,
00843 const TangoPointCloud* cloud),
00844 ...);
00845
00848
00849
00850
00851
00858 TangoErrorType TangoService_connectOnTangoEvent(
00859 void (*TangoService_onTangoEvent)(void* context, const TangoEvent* event),
00860 ...);
00861
00864
00865
00866
00867
00868
00869
00871 typedef void (*TangoService_OnTextureAvailable)(void*, TangoCameraId);
00872
00888 TangoErrorType TangoService_connectTextureId(
00889 TangoCameraId id, unsigned int tex, void* context,
00890 TangoService_OnTextureAvailable callback);
00891
00903 TangoErrorType TangoService_updateTexture(TangoCameraId id, double* timestamp);
00904
00918 TangoErrorType TangoService_connectOnTextureAvailable(
00919 TangoCameraId id, void* context, TangoService_OnTextureAvailable callback);
00920
00937 TangoErrorType TangoService_updateTextureExternalOes(TangoCameraId id,
00938 unsigned int tex,
00939 double* timestamp);
00940
00941 typedef int64_t TangoBufferId;
00942
00958 TangoErrorType TangoService_lockCameraBuffer(TangoCameraId id,
00959 double* timestamp,
00960 TangoBufferId* buffer);
00961
00969 void TangoService_unlockCameraBuffer(TangoCameraId id, TangoBufferId buffer);
00970
00986 TangoErrorType TangoService_updateTextureExternalOesForBuffer(
00987 TangoCameraId id, unsigned int texture_id, TangoBufferId buffer);
00988
01005 TangoErrorType TangoService_connectOnFrameAvailable(
01006 TangoCameraId id, void* context,
01007 void (*onFrameAvailable)(void* context, TangoCameraId id,
01008 const TangoImageBuffer* buffer));
01009
01026 TangoErrorType TangoService_connectOnImageAvailable(
01027 TangoCameraId id, void* context,
01028 void (*onImageAvailable)(void* context, TangoCameraId id,
01029 const TangoImage* image,
01030 const TangoCameraMetadata* metadata));
01031
01037 TangoErrorType TangoService_disconnectCamera(TangoCameraId id);
01038
01050 TangoErrorType TangoService_getCameraIntrinsics(TangoCameraId camera_id,
01051 TangoCameraIntrinsics* intrinsics);
01052
01055
01056
01057
01058
01059
01060
01061
01062
01063
01064
01065
01066
01067
01068
01069
01070
01104 TangoErrorType TangoService_saveAreaDescription(TangoUUID* uuid);
01105
01112 TangoErrorType TangoService_deleteAreaDescription(const TangoUUID uuid);
01113
01122 TangoErrorType TangoService_getAreaDescriptionUUIDList(char** uuid_list);
01123
01132 TangoErrorType TangoService_getAreaDescriptionMetadata(
01133 const TangoUUID uuid, TangoAreaDescriptionMetadata* metadata);
01134
01141 TangoErrorType TangoService_saveAreaDescriptionMetadata(
01142 const TangoUUID uuid, TangoAreaDescriptionMetadata metadata);
01143
01148 TangoErrorType TangoAreaDescriptionMetadata_free(
01149 TangoAreaDescriptionMetadata metadata);
01150
01159 TangoErrorType TangoService_importAreaDescription(const char* src_file_path,
01160 TangoUUID* uuid);
01161
01168 TangoErrorType TangoService_exportAreaDescription(
01169 const TangoUUID uuid, const char* dst_file_dir);
01170
01223 TangoErrorType TangoAreaDescriptionMetadata_get(
01224 TangoAreaDescriptionMetadata metadata, const char* key, size_t* value_size,
01225 char** value);
01226
01238 TangoErrorType TangoAreaDescriptionMetadata_set(
01239 TangoAreaDescriptionMetadata metadata, const char* key, size_t value_size,
01240 const char* value);
01241
01248 TangoErrorType TangoAreaDescriptionMetadata_listKeys(
01249 TangoAreaDescriptionMetadata metadata, char** key_list);
01250
01253
01254
01255
01256
01257
01258
01259
01260
01261
01262
01263
01264
01265
01266
01267
01268
01269
01270
01271
01272
01273
01274
01275
01276
01277
01278
01279
01280
01281
01282
01283
01284
01285
01286
01287
01288
01289
01290
01291
01292
01293
01294
01295
01296
01297
01298
01299
01300
01301
01302
01303
01304
01305
01306
01307
01308
01309
01310
01311
01312
01313
01314
01315
01316
01317
01318
01319
01320
01321
01322
01323
01324
01325
01326
01327
01328
01329
01330
01331
01332
01333
01334
01335
01336
01337
01338
01339
01340
01341
01342
01343
01344
01345
01346
01347
01348
01349
01350
01351
01352
01353
01354
01355
01356
01357
01358
01359
01360
01361
01362
01363
01364
01365
01366
01374 TangoErrorType TangoConfig_setBool(TangoConfig config, const char* key,
01375 bool value);
01376
01384 TangoErrorType TangoConfig_setInt32(TangoConfig config, const char* key,
01385 int32_t value);
01386
01394 TangoErrorType TangoConfig_setInt64(TangoConfig config, const char* key,
01395 int64_t value);
01396
01404 TangoErrorType TangoConfig_setDouble(TangoConfig config, const char* key,
01405 double value);
01406
01414 TangoErrorType TangoConfig_setString(TangoConfig config, const char* key,
01415 const char* value);
01416
01424 TangoErrorType TangoConfig_getBool(TangoConfig config, const char* key,
01425 bool* value);
01426
01434 TangoErrorType TangoConfig_getInt32(TangoConfig config, const char* key,
01435 int32_t* value);
01436
01444 TangoErrorType TangoConfig_getInt64(TangoConfig config, const char* key,
01445 int64_t* value);
01446
01454 TangoErrorType TangoConfig_getDouble(TangoConfig config, const char* key,
01455 double* value);
01456
01467 TangoErrorType TangoConfig_getString(TangoConfig config, const char* key,
01468 char* value, size_t size);
01471
01472
01473
01474
01475
01476
01477
01478
01479
01480
01481
01482
01483
01484
01485
01486
01487
01488
01489
01490
01491
01492
01493
01494
01495
01496 TangoErrorType TangoService_Experimental_connectTextureIdUnity(
01497 TangoCameraId id, unsigned int texture_y, unsigned int texture_Cb,
01498 unsigned int texture_Cr, void* context,
01499 void (*callback)(void*, TangoCameraId));
01500
01516 TangoErrorType TangoService_Experimental_getDatasetUUIDs(
01517 TangoUUID** dataset_uuids, int* num_dataset_uuids);
01518
01525 TangoErrorType TangoService_Experimental_releaseDatasetUUIDs(
01526 TangoUUID** dataset_uuids);
01527
01535 TangoErrorType TangoService_Experimental_deleteDataset(
01536 const TangoUUID dataset_uuid);
01537
01543 TangoErrorType TangoService_Experimental_getCurrentDatasetUUID(
01544 TangoUUID* dataset_uuid);
01545
01546 #ifdef __cplusplus
01547 }
01548 #endif
01549
01550 #endif // TANGO_CLIENT_API_HEADER_TANGO_CLIENT_API_H_