コード例 #1
0
TArray<FString> UTangoDevice::GetAllUUIDs()
{
	TArray<FString> ReturnValues;
#if PLATFORM_ANDROID
	char* uuid;
	if (TangoService_getAreaDescriptionUUIDList(&uuid) == TANGO_SUCCESS)
	{
		FString(uuid).ParseIntoArray(ReturnValues, TEXT(","), true);
	}
#endif
	return ReturnValues;
}
コード例 #2
0
bool TangoData::SetConfig(bool is_auto_recovery) {
  // Get the default TangoConfig.
  // We get the default config first and change the config
  // flag as needed.
  config_ = TangoService_getConfig(TANGO_CONFIG_DEFAULT);
  if (config_ == NULL) {
    LOGE("TangoService_getConfig(): Failed");
    return false;
  }

  // Turn on auto recovery for motion tracking.
  // Note that the auto-recovery is on by default.
  if (TangoConfig_setBool(config_, "config_enable_auto_recovery",
                          is_auto_recovery) != TANGO_SUCCESS) {
    LOGE("config_enable_auto_recovery(): Failed");
    return false;
  }

  // Get library version string from service.
  TangoConfig_getString(config_, "tango_service_library_version",
                        const_cast<char*>(lib_version_string.c_str()),
                        kVersionStringLength);

  // Setting up the start of service to ADF frame for the onPoseAvailable
  // callback,
  // it will check the localization status.
  TangoCoordinateFramePair pair;
  pair.base = TANGO_COORDINATE_FRAME_AREA_DESCRIPTION;
  pair.target = TANGO_COORDINATE_FRAME_START_OF_SERVICE;

  // Attach onPoseAvailable callback.
  // The callback will be called after the service is connected.
  if (TangoService_connectOnPoseAvailable(1, &pair, onPoseAvailable) !=
      TANGO_SUCCESS) {
    LOGE("TangoService_connectOnPoseAvailable(): Failed");
    return false;
  }

  // Attach onEventAvailable callback.
  // The callback will be called after the service is connected.
  if (TangoService_connectOnTangoEvent(onTangoEvent) != TANGO_SUCCESS) {
    LOGE("TangoService_connectOnTangoEvent(): Failed");
    return false;
  }

  // Load the most recent ADF.
  char* uuid_list;

  // uuid_list will contain a comma separated list of UUIDs.
  if (TangoService_getAreaDescriptionUUIDList(&uuid_list) != TANGO_SUCCESS) {
    LOGI("TangoService_getAreaDescriptionUUIDList");
  }

  // Parse the uuid_list to get the individual uuids.
  if (uuid_list != NULL && uuid_list[0] != '\0') {
    vector<string> adf_list;

    char* parsing_char;
    parsing_char = strtok(uuid_list, ",");
    while (parsing_char != NULL) {
      string s = string(parsing_char);
      adf_list.push_back(s);
      parsing_char = strtok(NULL, ",");
    }

    int list_size = adf_list.size();
    if (list_size == 0) {
      LOGE("List size is 0");
      return false;
    }
    cur_uuid = adf_list[list_size - 1];
    if (TangoConfig_setString(config_, "config_load_area_description_UUID",
                              adf_list[list_size - 1].c_str()) !=
        TANGO_SUCCESS) {
      LOGE("config_load_area_description_uuid Failed");
      return false;
    } else {
      LOGI("Load ADF: %s", adf_list[list_size - 1].c_str());
    }
  } else {
    LOGE("No area description file available, no file loaded.");
  }
  is_localized = false;
  return true;
}