// // ESTI - ARF // // First Version 2020 Patrick Harms // Modified: // - 2021, Sylvain Renault, Fraunhofer HHI // // #define USING_OPENAPI_GENERATOR // alt. is Swagger using System.IO; using System.Collections.Generic; using UnityEngine; #if USING_OPENAPI_GENERATOR using Org.OpenAPITools.Api; using Org.OpenAPITools.Model; #else using IO.Swagger.Api; using IO.Swagger.Model; #endif #if UNITY_EDITOR public class RESTRequest { static public void PostAddTrackable(string basePath) { Debug.Log("Posting Add Trackable to Server"); TrackablesApi api = new TrackablesApi(basePath); Debug.Log("created Trackables API"); TrackableEncodingInformationStructure trackableEncodingInformation = new TrackableEncodingInformationStructure(TrackableEncodingInformationStructure.DataFormatEnum.ARCORE, "1.0"); Debug.Log("created encoding information"); #if USING_OPENAPI_GENERATOR List trackableDimension = new List(); #else List trackableDimension = new List(); #endif trackableDimension.Add(5); trackableDimension.Add(5); Debug.Log("created dimension"); byte[] bytes = new byte[100]; for (int i = 0; i < bytes.Length; i++) { bytes[i] = (byte)i; } string result = api.AddTrackable("testCreatorUID", "FIDUCIAL_MARKER", trackableEncodingInformation, bytes, UnitSystemEnum.METERS, trackableDimension); Debug.Log(result); } static public void PostAddWorldAnchor(string basePath) { Debug.Log("Posting Add World Anchor to Server"); WorldAnchorsApi api = new WorldAnchorsApi(basePath); Debug.Log("created World Anchors API"); TrackableEncodingInformationStructure trackableEncodingInformation = new TrackableEncodingInformationStructure(TrackableEncodingInformationStructure.DataFormatEnum.ARCORE, "1.0"); Debug.Log("created encoding information"); List trackableDimension = new List(); trackableDimension.Add(5); trackableDimension.Add(5); Debug.Log("created dimension"); byte[] bytes = new byte[100]; for (int i = 0; i < bytes.Length; i++) { bytes[i] = (byte)i; } string result = api.AddWorldAnchor("testCreatorUID", UnitSystemEnum.METERS); Debug.Log(result); } } #endif