Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • arf/world-storage-api-helpers/unity-world-storage-package
1 result
Show changes
...@@ -15,18 +15,16 @@ ...@@ -15,18 +15,16 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// //
// Last change: March 2024 // Last change: June 2024
// //
#define USING_OPENAPI_GENERATOR // alt. is Swagger
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
using UnityEngine; using UnityEngine;
using ETSI.ARF.OpenAPI.WorldStorage;
using ETSI.ARF.OpenAPI; using ETSI.ARF.OpenAPI;
using ETSI.ARF.OpenAPI.WorldStorage;
namespace ETSI.ARF.WorldStorage.REST namespace ETSI.ARF.WorldStorage.REST
{ {
...@@ -35,65 +33,120 @@ namespace ETSI.ARF.WorldStorage.REST ...@@ -35,65 +33,120 @@ namespace ETSI.ARF.WorldStorage.REST
// //
// Wrapper for the endpoints // Wrapper for the endpoints
// //
static public Trackable GetTrackableSync(WorldStorageServer ws, Guid UUID)
{
wsServer = ws;
var httpClient = new BasicHTTPClient(ws.URI);
apiClient = new WorldStorageClient(httpClient);
Debug.Log($"[REST] Request Trackable {UUID}...");
return apiClient.GetTrackableById(token, UUID);
}
static public ResponseObject<Trackable> GetTrackableAsync(WorldStorageServer ws, Guid UUID, Action<ResponseObject<Trackable>> func) static public ResponseObject<Trackable> GetTrackableAsync(WorldStorageServer ws, Guid UUID, Action<ResponseObject<Trackable>> func)
{ {
wsServer = ws; wsServer = ws;
var httpClient = new UnityWebRequestHttpClient(ws.URI); var httpClient = new UnityWebRequestHttpClient(ws.URI);
apiClient = new WorldStorageClient(httpClient); apiClient = new WorldStorageClient(httpClient);
Debug.Log("Request 1 Trackable..."); Debug.Log($"[REST] Request Trackable {UUID}...");
ResponseObject<Trackable> ro = new ResponseObject<Trackable>("Request Trackable " + UUID.ToString(), func); ResponseObject<Trackable> ro = new ResponseObject<Trackable>("Request Trackable " + UUID.ToString(), func);
apiClient.GetTrackableByIdAsync(token, UUID, ro.cancellationToken).ContinueWith(OnReceiveObject<Trackable>, ro); apiClient.GetTrackableByIdAsync(token, UUID, ro.cancellationToken).ContinueWith(OnReceiveObject<Trackable>, ro);
return ro; return ro;
} }
static public List<Trackable> GetTrackablesSync(WorldStorageServer ws)
{
wsServer = ws;
var httpClient = new BasicHTTPClient(ws.URI);
apiClient = new WorldStorageClient(httpClient);
Debug.Log("[REST] Request Trackables...");
return apiClient.GetTrackables(token);
}
static public ResponseObject<List<Trackable>> GetTrackablesAsync(WorldStorageServer ws, Action<ResponseObject<List<Trackable>>> func) static public ResponseObject<List<Trackable>> GetTrackablesAsync(WorldStorageServer ws, Action<ResponseObject<List<Trackable>>> func)
{ {
wsServer = ws; wsServer = ws;
var httpClient = new UnityWebRequestHttpClient(ws.URI); var httpClient = new UnityWebRequestHttpClient(ws.URI);
apiClient = new WorldStorageClient(httpClient); apiClient = new WorldStorageClient(httpClient);
Debug.Log("Request Trackables..."); Debug.Log("[REST] Request Trackables...");
ResponseObject<List<Trackable>> ro = new ResponseObject<List<Trackable>>("Request Trackables", func); ResponseObject<List<Trackable>> ro = new ResponseObject<List<Trackable>>("Request Trackables", func);
apiClient.GetTrackablesAsync(token, ro.cancellationToken).ContinueWith(OnReceiveListOfObjects<Trackable>, ro); apiClient.GetTrackablesAsync(token, ro.cancellationToken).ContinueWith(OnReceiveListOfObjects<Trackable>, ro);
return ro; return ro;
} }
static public string CreateTrackableSync(WorldStorageServer ws, Trackable trackable)
{
wsServer = ws;
var httpClient = new BasicHTTPClient(ws.URI);
apiClient = new WorldStorageClient(httpClient);
// Add some management stuffs
if (trackable.UUID == Guid.Empty) trackable.UUID = Guid.NewGuid();
if (trackable.CreatorUUID == Guid.Empty) trackable.CreatorUUID = System.Guid.Parse("8fb169e2-8910-4cd5-a8f9-b7abff38d013");
Debug.Log($"[REST] Create Trackable {trackable.UUID}...");
return apiClient.AddTrackable(token, trackable);
}
static public ResponseObject<string> CreateTrackableAsync(WorldStorageServer ws, Trackable trackable, Action<ResponseObject<string>> func) static public ResponseObject<string> CreateTrackableAsync(WorldStorageServer ws, Trackable trackable, Action<ResponseObject<string>> func)
{ {
wsServer = ws; wsServer = ws;
var httpClient = new UnityWebRequestHttpClient(ws.URI); var httpClient = new UnityWebRequestHttpClient(ws.URI);
apiClient = new WorldStorageClient(httpClient); apiClient = new WorldStorageClient(httpClient);
Debug.Log("Create 1 Trackable...");
// Add some management stuffs // Add some management stuffs
trackable.UUID = Guid.NewGuid(); if (trackable.UUID == Guid.Empty) trackable.UUID = Guid.NewGuid();
trackable.CreatorUUID = Guid.Empty; if (trackable.CreatorUUID == Guid.Empty) trackable.CreatorUUID = System.Guid.Parse("8fb169e2-8910-4cd5-a8f9-b7abff38d013");
Debug.Log($"[REST] Create Trackable {trackable.UUID}...");
ResponseObject<string> ro = new ResponseObject<string>("Create Trackable " + trackable.Name + " (no UUID)", func); ResponseObject<string> ro = new ResponseObject<string>("Create Trackable " + trackable.Name + " (no UUID)", func);
apiClient.AddTrackableAsync(token, trackable, ro.cancellationToken).ContinueWith(OnReceiveObject<string>, ro); apiClient.AddTrackableAsync(token, trackable, ro.cancellationToken).ContinueWith(OnReceiveObject<string>, ro);
return ro; return ro;
} }
static public string UpdateTrackableSync(WorldStorageServer ws, Trackable trackable)
{
wsServer = ws;
var httpClient = new BasicHTTPClient(ws.URI);
apiClient = new WorldStorageClient(httpClient);
Debug.Log($"[REST] Update Trackable {trackable.UUID}...");
return apiClient.ModifyTrackable(token, trackable);
}
static public ResponseObject<string> UpdateTrackableAsync(WorldStorageServer ws, Trackable trackable, Action<ResponseObject<string>> func) static public ResponseObject<string> UpdateTrackableAsync(WorldStorageServer ws, Trackable trackable, Action<ResponseObject<string>> func)
{ {
wsServer = ws; wsServer = ws;
var httpClient = new UnityWebRequestHttpClient(ws.URI); var httpClient = new UnityWebRequestHttpClient(ws.URI);
apiClient = new WorldStorageClient(httpClient); apiClient = new WorldStorageClient(httpClient);
Debug.Log("Update Trackable..."); Debug.Log($"[REST] Update Trackable {trackable.UUID}...");
ResponseObject<string> ro = new ResponseObject<string>("Update Trackable " + trackable.UUID.ToString(), func); ResponseObject<string> ro = new ResponseObject<string>("Update Trackable " + trackable.UUID.ToString(), func);
apiClient.ModifyTrackableAsync(token, trackable,ro.cancellationToken).ContinueWith(OnReceiveObject<string>, ro); apiClient.ModifyTrackableAsync(token, trackable,ro.cancellationToken).ContinueWith(OnReceiveObject<string>, ro);
return ro; return ro;
} }
static public string DeleteTrackableSync(WorldStorageServer ws, Guid UUID)
{
wsServer = ws;
var httpClient = new BasicHTTPClient(ws.URI);
apiClient = new WorldStorageClient(httpClient);
Debug.Log($"[REST] Delete Trackable {UUID}...");
return apiClient.DeleteTrackable(token, UUID);
}
static public ResponseObject<string> DeleteTrackableAsync(WorldStorageServer ws, Guid UUID, Action<ResponseObject<string>> func) static public ResponseObject<string> DeleteTrackableAsync(WorldStorageServer ws, Guid UUID, Action<ResponseObject<string>> func)
{ {
wsServer = ws; wsServer = ws;
var httpClient = new UnityWebRequestHttpClient(ws.URI); var httpClient = new UnityWebRequestHttpClient(ws.URI);
apiClient = new WorldStorageClient(httpClient); apiClient = new WorldStorageClient(httpClient);
Debug.Log("Delete 1 Trackable..."); Debug.Log($"[REST] Delete Trackable {UUID}...");
ResponseObject<string> ro = new ResponseObject<string>("Delete Trackable " + UUID.ToString(), func); ResponseObject<string> ro = new ResponseObject<string>("Delete Trackable " + UUID.ToString(), func);
apiClient.DeleteTrackableAsync(token, UUID, ro.cancellationToken).ContinueWith(OnReceiveObject<string>, ro); apiClient.DeleteTrackableAsync(token, UUID, ro.cancellationToken).ContinueWith(OnReceiveObject<string>, ro);
return ro; return ro;
......
...@@ -18,55 +18,139 @@ ...@@ -18,55 +18,139 @@
// Last change: March 2024 // Last change: March 2024
// //
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine; using UnityEngine;
using ETSI.ARF.OpenAPI;
using ETSI.ARF.OpenAPI.WorldStorage; using ETSI.ARF.OpenAPI.WorldStorage;
//#if UNITY_EDITOR //#if UNITY_EDITOR
namespace ETSI.ARF.WorldStorage.REST namespace ETSI.ARF.WorldStorage.REST
{ {
public class WorldAnchorRequest public class WorldAnchorRequest : RequestBase<WorldAnchor>
{ {
//static public string AddWorldAnchor(WorldStorageServer ws, WorldAnchor anchor) //
//{ // Wrapper for the endpoints
// Debug.Log("Posting Add World Anchor to Server"); //
// WorldAnchorsApi api = new WorldAnchorsApi(ws.URI); static public WorldAnchor GetWorldAnchorSync(WorldStorageServer ws, Guid UUID)
// string result = api.AddWorldAnchor(anchor); {
// Debug.Log(result); wsServer = ws;
// return result; var httpClient = new BasicHTTPClient(ws.URI);
//} apiClient = new WorldStorageClient(httpClient);
//static public string UpdateWorldAnchor(WorldStorageServer ws, WorldAnchor anchor) Debug.Log($"[REST] Request WorldAnchor {UUID}...");
//{ return apiClient.GetWorldAnchorById(token, UUID);
// Debug.Log("Posting Add World Anchor to Server"); }
// WorldAnchorsApi api = new WorldAnchorsApi(ws.URI);
// string result = api.ModifyWorldAnchor(anchor); static public ResponseObject<WorldAnchor> GetWorldAnchorAsync(WorldStorageServer ws, Guid UUID, Action<ResponseObject<WorldAnchor>> func)
// Debug.Log(result); {
// return result; wsServer = ws;
//} var httpClient = new UnityWebRequestHttpClient(ws.URI);
apiClient = new WorldStorageClient(httpClient);
//static public List<WorldAnchor> GetAllWorldAnchors(WorldStorageServer ws)
//{ Debug.Log($"[REST] Request WorldAnchor {UUID}...");
// WorldAnchorsApi api = new WorldAnchorsApi(ws.URI); ResponseObject<WorldAnchor> ro = new ResponseObject<WorldAnchor>("Request WorldAnchor " + UUID.ToString(), func);
// List<WorldAnchor> result = api.GetWorldAnchors(); apiClient.GetWorldAnchorByIdAsync(token, UUID, ro.cancellationToken).ContinueWith(OnReceiveObject<WorldAnchor>, ro);
// return result; return ro;
//} }
//static public WorldAnchor GetWorldAnchor(WorldStorageServer ws, string uuid) static public List<WorldAnchor> GetWorldAnchorsSync(WorldStorageServer ws)
//{ {
// System.Guid _uuid = System.Guid.Parse(uuid); wsServer = ws;
// WorldAnchorsApi api = new WorldAnchorsApi(ws.URI); var httpClient = new BasicHTTPClient(ws.URI);
// WorldAnchor result = api.GetWorldAnchorById(_uuid); apiClient = new WorldStorageClient(httpClient);
// return result;
//} Debug.Log("[REST] Request WorldAnchors...");
return apiClient.GetWorldAnchors(token);
//static public void DeleteWorldAnchor(WorldStorageServer ws, string uuid) }
//{
// System.Guid _uuid = System.Guid.Parse(uuid); static public ResponseObject<List<WorldAnchor>> GetWorldAnchorsAsync(WorldStorageServer ws, Action<ResponseObject<List<WorldAnchor>>> func)
// WorldAnchorsApi api = new WorldAnchorsApi(ws.URI); {
// api.DeleteWorldAnchor(_uuid); wsServer = ws;
//} var httpClient = new UnityWebRequestHttpClient(ws.URI);
apiClient = new WorldStorageClient(httpClient);
Debug.Log("[REST] Request WorldAnchors...");
ResponseObject<List<WorldAnchor>> ro = new ResponseObject<List<WorldAnchor>>("Request WorldAnchors", func);
apiClient.GetWorldAnchorsAsync(token, ro.cancellationToken).ContinueWith(OnReceiveListOfObjects<WorldAnchor>, ro);
return ro;
}
static public string CreateWorldAnchorSync(WorldStorageServer ws, WorldAnchor worldAnchor)
{
wsServer = ws;
var httpClient = new BasicHTTPClient(ws.URI);
apiClient = new WorldStorageClient(httpClient);
// Add some management stuffs
if (worldAnchor.UUID == Guid.Empty) worldAnchor.UUID = Guid.NewGuid();
if (worldAnchor.CreatorUUID == Guid.Empty) worldAnchor.CreatorUUID = System.Guid.Parse("8fb169e2-8910-4cd5-a8f9-b7abff38d013");
Debug.Log($"[REST] Create WorldAnchor {worldAnchor.UUID}...");
return apiClient.AddWorldAnchor(token, worldAnchor);
}
static public ResponseObject<string> CreateWorldAnchorAsync(WorldStorageServer ws, WorldAnchor worldAnchor, Action<ResponseObject<string>> func)
{
wsServer = ws;
var httpClient = new UnityWebRequestHttpClient(ws.URI);
apiClient = new WorldStorageClient(httpClient);
// Add some management stuffs
if (worldAnchor.UUID == Guid.Empty) worldAnchor.UUID = Guid.NewGuid();
if (worldAnchor.CreatorUUID == Guid.Empty) worldAnchor.CreatorUUID = System.Guid.Parse("8fb169e2-8910-4cd5-a8f9-b7abff38d013");
Debug.Log($"[REST] Create WorldAnchor {worldAnchor.UUID}...");
ResponseObject<string> ro = new ResponseObject<string>("Create WorldAnchor " + worldAnchor.Name + " (no UUID)", func);
apiClient.AddWorldAnchorAsync(token, worldAnchor, ro.cancellationToken).ContinueWith(OnReceiveObject<string>, ro);
return ro;
}
static public string UpdateWorldAnchorSync(WorldStorageServer ws, WorldAnchor worldAnchor)
{
wsServer = ws;
var httpClient = new BasicHTTPClient(ws.URI);
apiClient = new WorldStorageClient(httpClient);
Debug.Log($"[REST] Update WorldAnchor {worldAnchor.UUID}...");
return apiClient.ModifyWorldAnchor(token, worldAnchor);
}
static public ResponseObject<string> UpdateWorldAnchorAsync(WorldStorageServer ws, WorldAnchor worldAnchor, Action<ResponseObject<string>> func)
{
wsServer = ws;
var httpClient = new UnityWebRequestHttpClient(ws.URI);
apiClient = new WorldStorageClient(httpClient);
Debug.Log($"[REST] Update WorldAnchor {worldAnchor.UUID}...");
ResponseObject<string> ro = new ResponseObject<string>("Update WorldAnchor " + worldAnchor.UUID.ToString(), func);
apiClient.ModifyWorldAnchorAsync(token, worldAnchor, ro.cancellationToken).ContinueWith(OnReceiveObject<string>, ro);
return ro;
}
static public string DeleteWorldAnchorSync(WorldStorageServer ws, Guid UUID)
{
wsServer = ws;
var httpClient = new BasicHTTPClient(ws.URI);
apiClient = new WorldStorageClient(httpClient);
Debug.Log($"[REST] Delete WorldAnchor {UUID}...");
return apiClient.DeleteWorldAnchor(token, UUID);
}
static public ResponseObject<string> DeleteWorldAnchorAsync(WorldStorageServer ws, Guid UUID, Action<ResponseObject<string>> func)
{
wsServer = ws;
var httpClient = new UnityWebRequestHttpClient(ws.URI);
apiClient = new WorldStorageClient(httpClient);
Debug.Log($"[REST] Delete WorldAnchor {UUID}...");
ResponseObject<string> ro = new ResponseObject<string>("Delete WorldAnchor " + UUID.ToString(), func);
apiClient.DeleteWorldAnchorAsync(token, UUID, ro.cancellationToken).ContinueWith(OnReceiveObject<string>, ro);
return ro;
}
} }
} }
//#endif //#endif
\ No newline at end of file
...@@ -15,58 +15,141 @@ ...@@ -15,58 +15,141 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// //
// Last change: March 2024 // Last change: June 2024
// //
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine; using UnityEngine;
using ETSI.ARF.OpenAPI;
using ETSI.ARF.OpenAPI.WorldStorage; using ETSI.ARF.OpenAPI.WorldStorage;
//#if UNITY_EDITOR
namespace ETSI.ARF.WorldStorage.REST namespace ETSI.ARF.WorldStorage.REST
{ {
public class WorldLinkRequest public class WorldLinkRequest : RequestBase<WorldLink>
{ {
//static public string AddWorldLink(WorldStorageServer ws, WorldLink link) //
//{ // Wrapper for the endpoints
// Debug.Log("Posting Add Trackable to Server"); //
// WorldLinksApi api = new WorldLinksApi(ws.URI); static public WorldLink GetWorldLinkSync(WorldStorageServer ws, Guid UUID)
// string result = api.AddWorldLink(link); {
// Debug.Log(result); wsServer = ws;
// return result; var httpClient = new BasicHTTPClient(ws.URI);
//} apiClient = new WorldStorageClient(httpClient);
//static public string UpdateWorldLink(WorldStorageServer ws, WorldLink link) Debug.Log($"[REST] Request WorldLink {UUID}...");
//{ return apiClient.GetWorldLinkById(token, UUID);
// Debug.Log("Posting Add Trackable to Server"); }
// WorldLinksApi api = new WorldLinksApi(ws.URI);
// string result = api.ModifyWorldLink(link); static public ResponseObject<WorldLink> GetWorldLinkAsync(WorldStorageServer ws, Guid UUID, Action<ResponseObject<WorldLink>> func)
// Debug.Log(result); {
// return result; wsServer = ws;
//} var httpClient = new UnityWebRequestHttpClient(ws.URI);
apiClient = new WorldStorageClient(httpClient);
//static public List<WorldLink> GetAllWorldLinks(WorldStorageServer ws)
//{ Debug.Log($"[REST] Request WorldLink {UUID}...");
// WorldLinksApi api = new WorldLinksApi(ws.URI); ResponseObject<WorldLink> ro = new ResponseObject<WorldLink>("Request WorldLink " + UUID.ToString(), func);
// List<WorldLink> result = api.GetWorldLinks(); apiClient.GetWorldLinkByIdAsync(token, UUID, ro.cancellationToken).ContinueWith(OnReceiveObject<WorldLink>, ro);
// return result; return ro;
//} }
//static public WorldLink GetWorldLink(WorldStorageServer ws, string uuid) static public List<WorldLink> GetWorldLinksSync(WorldStorageServer ws)
//{ {
// System.Guid _uuid = System.Guid.Parse(uuid); wsServer = ws;
// WorldLinksApi api = new WorldLinksApi(ws.URI); var httpClient = new BasicHTTPClient(ws.URI);
// WorldLink result = api.GetWorldLinkById(_uuid); apiClient = new WorldStorageClient(httpClient);
// return result;
//} Debug.Log("[REST] Request WorldLinks...");
return apiClient.GetWorldLinks(token);
//static public void DeleteWorldLink(WorldStorageServer ws, string uuid) }
//{
// System.Guid _uuid = System.Guid.Parse(uuid); static public ResponseObject<List<WorldLink>> GetWorldLinksAsync(WorldStorageServer ws, Action<ResponseObject<List<WorldLink>>> func)
// WorldLinksApi api = new WorldLinksApi(ws.URI); {
// api.DeleteWorldLink(_uuid); wsServer = ws;
//} var httpClient = new UnityWebRequestHttpClient(ws.URI);
apiClient = new WorldStorageClient(httpClient);
Debug.Log("[REST] Request WorldLinks...");
ResponseObject<List<WorldLink>> ro = new ResponseObject<List<WorldLink>>("Request WorldLinks", func);
apiClient.GetWorldLinksAsync(token, ro.cancellationToken).ContinueWith(OnReceiveListOfObjects<WorldLink>, ro);
return ro;
}
static public string CreateWorldLinkSync(WorldStorageServer ws, WorldLink worldLink)
{
wsServer = ws;
var httpClient = new BasicHTTPClient(ws.URI);
apiClient = new WorldStorageClient(httpClient);
// Add some management stuffs
if (worldLink.UUID == Guid.Empty) worldLink.UUID = Guid.NewGuid();
if (worldLink.CreatorUUID == Guid.Empty) worldLink.CreatorUUID = System.Guid.Parse("8fb169e2-8910-4cd5-a8f9-b7abff38d013");
Debug.Log($"[REST] Create WorldLink {worldLink.UUID}...");
return apiClient.AddWorldLink(token, worldLink);
}
static public ResponseObject<string> CreateWorldLinkAsync(WorldStorageServer ws, WorldLink worldLink, Action<ResponseObject<string>> func)
{
wsServer = ws;
var httpClient = new UnityWebRequestHttpClient(ws.URI);
apiClient = new WorldStorageClient(httpClient);
// Add some management stuffs
if (worldLink.UUID == Guid.Empty) worldLink.UUID = Guid.NewGuid();
if (worldLink.CreatorUUID == Guid.Empty) worldLink.CreatorUUID = System.Guid.Parse("8fb169e2-8910-4cd5-a8f9-b7abff38d013");
Debug.Log($"[REST] Create WorldLink {worldLink.UUID}...");
ResponseObject<string> ro = new ResponseObject<string>("Create WorldLink (no UUID)", func);
apiClient.AddWorldLinkAsync(token, worldLink, ro.cancellationToken).ContinueWith(OnReceiveObject<string>, ro);
return ro;
}
static public string UpdateWorldLinkSync(WorldStorageServer ws, WorldLink worldLink)
{
wsServer = ws;
var httpClient = new BasicHTTPClient(ws.URI);
apiClient = new WorldStorageClient(httpClient);
Debug.Log($"[REST] Update WorldLink {worldLink.UUID}...");
return apiClient.ModifyWorldLink(token, worldLink);
}
static public ResponseObject<string> UpdateWorldLinkAsync(WorldStorageServer ws, WorldLink worldLink, Action<ResponseObject<string>> func)
{
wsServer = ws;
var httpClient = new UnityWebRequestHttpClient(ws.URI);
apiClient = new WorldStorageClient(httpClient);
Debug.Log($"[REST] Update WorldLink {worldLink.UUID}...");
ResponseObject<string> ro = new ResponseObject<string>("Update WorldLink " + worldLink.UUID.ToString(), func);
apiClient.ModifyWorldLinkAsync(token, worldLink, ro.cancellationToken).ContinueWith(OnReceiveObject<string>, ro);
return ro;
}
static public string DeleteWorldLinkSync(WorldStorageServer ws, Guid UUID)
{
wsServer = ws;
var httpClient = new BasicHTTPClient(ws.URI);
apiClient = new WorldStorageClient(httpClient);
Debug.Log($"[REST] Delete WorldLink {UUID}...");
return apiClient.DeleteWorldLink(token, UUID);
}
static public ResponseObject<string> DeleteWorldLinkAsync(WorldStorageServer ws, Guid UUID, Action<ResponseObject<string>> func)
{
wsServer = ws;
var httpClient = new UnityWebRequestHttpClient(ws.URI);
apiClient = new WorldStorageClient(httpClient);
Debug.Log($"[REST] Delete WorldLink {UUID}...");
ResponseObject<string> ro = new ResponseObject<string>("Delete WorldLink " + UUID.ToString(), func);
apiClient.DeleteWorldLinkAsync(token, UUID, ro.cancellationToken).ContinueWith(OnReceiveObject<string>, ro);
return ro;
}
} }
} }
//#endif //#endif
\ No newline at end of file
// //
// ARF - Augmented Reality Framework (ETSI ISG ARF) // ARF - Augmented Reality Framework (ETSI ISG ARF)
// //
// Copyright 2022 ETSI // Copyright 2024 ETSI
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
......
using ETSI.ARF.OpenAPI.WorldStorage;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class WorldStorageUnityHelper
{
/// <summary>
/// Convert a float array of length 16 to a Matrix
/// </summary>
/// <param name="matrix">the values to convert</param>
/// <returns>Converted Unity Matrix</returns>
public static ETSI.ARF.OpenAPI.WorldStorage.Transform3D ConvertUnityToETSIARFTransform3D(Matrix4x4 value)
{
Transform3D result = new Transform3D
{
value.m00, value.m01, value.m02, value.m03,
value.m10, value.m11, value.m12, value.m13,
value.m20, value.m21, value.m22, value.m23,
value.m30, value.m31, value.m32, value.m33,
};
return result;
}
/// <summary>
/// Convert a float array of length 16 to a Matrix
/// </summary>
/// <param name="matrix">the values to convert</param>
/// <returns>Converted Unity Matrix</returns>
public static Matrix4x4 ConvertETSIARFTransform3DToUnity(ETSI.ARF.OpenAPI.WorldStorage.Transform3D value)
{
if (value.Count == 16)
{
Matrix4x4 resul = new Matrix4x4();
resul[0, 0] = value[0];
resul[0, 1] = value[1];
resul[0, 2] = value[2];
resul[0, 3] = value[3];
resul[1, 0] = value[4];
resul[1, 1] = value[5];
resul[1, 2] = value[6];
resul[1, 3] = value[7];
resul[2, 0] = value[8];
resul[2, 1] = value[9];
resul[2, 2] = value[10];
resul[2, 3] = value[11];
resul[3, 0] = value[12];
resul[3, 1] = value[13];
resul[3, 2] = value[14];
resul[3, 3] = value[15];
return resul;
}
else
{
throw new ArgumentException("The numer of floats in the value parameter must be 16!");
}
}
static public Matrix4x4 MatrixFromLocalCRS(List<float> value)
{
Matrix4x4 result = new Matrix4x4();
result.m00 = value[0]; result.m01 = value[1]; result.m02 = value[2]; result.m03 = value[3];
result.m10 = value[4]; result.m11 = value[5]; result.m12 = value[6]; result.m13 = value[7];
result.m20 = value[8]; result.m21 = value[9]; result.m22 = value[10]; result.m23 = value[11];
result.m30 = value[12]; result.m31 = value[13]; result.m32 = value[14]; result.m33 = value[15];
return result;
}
}
fileFormatVersion: 2
guid: dc92958843a03644e8524fd2312c3f42
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2 fileFormatVersion: 2
guid: a94d6effd437d7842907e9a5cfd2732f guid: 7cf3a1fe1b3964e41afa78147db793b0
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
......