diff --git a/Editor/Scripts/WorldStorageInfoEditor.cs b/Editor/Scripts/WorldStorageInfoEditor.cs
index 7d7e422b0becfcdf4863964beb1167be692de1a3..89cbd5305038824c03b68c5a6403a7c46aaa5af7 100644
--- a/Editor/Scripts/WorldStorageInfoEditor.cs
+++ b/Editor/Scripts/WorldStorageInfoEditor.cs
@@ -1,7 +1,7 @@
//
// ARF - Augmented Reality Framework (ETSI ISG ARF)
//
-// Copyright 2022 ETSI
+// Copyright 2024 ETSI
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
diff --git a/Runtime/Scriptables/WorldStorageServer.cs b/Runtime/Scriptables/WorldStorageServer.cs
index 8b09622c9f69c1303323b762b3f273b7badd7d00..01a2f1d42046d1650561590d1bf88a4d03569ead 100644
--- a/Runtime/Scriptables/WorldStorageServer.cs
+++ b/Runtime/Scriptables/WorldStorageServer.cs
@@ -1,7 +1,7 @@
//
// ARF - Augmented Reality Framework (ETSI ISG ARF)
//
-// Copyright 2022 ETSI
+// Copyright 2024 ETSI
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
diff --git a/Runtime/Scriptables/WorldStorageUser.cs b/Runtime/Scriptables/WorldStorageUser.cs
index d00b20a52fcb1805a73e8da2924c23769608d87f..cce62479ed72be1c722ba133dd048f9de9001518 100644
--- a/Runtime/Scriptables/WorldStorageUser.cs
+++ b/Runtime/Scriptables/WorldStorageUser.cs
@@ -1,7 +1,7 @@
//
// ARF - Augmented Reality Framework (ETSI ISG ARF)
//
-// Copyright 2022 ETSI
+// Copyright 2024 ETSI
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
diff --git a/Runtime/Scripts/OpenAPI/BaseClient.cs b/Runtime/Scripts/OpenAPI/BaseClient.cs
new file mode 100644
index 0000000000000000000000000000000000000000..83fa8c3bfc606c775cfb77a48685d4928320ea3d
--- /dev/null
+++ b/Runtime/Scripts/OpenAPI/BaseClient.cs
@@ -0,0 +1,38 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+namespace ETSI.ARF.OpenAPI
+{
+ ///
+ /// Simple class to debug the requests
+ ///
+ public class BaseClient
+ {
+ static public bool EnableClientLog = false;
+ public string lastJsonText;
+ public long lastPayload;
+
+ protected void _prepareRequest(ETSI.ARF.OpenAPI.IHttpClient client, System.Net.Http.HttpRequestMessage request, string url)
+ {
+ if (EnableClientLog)
+ {
+ Debug.Log("[REST][URL] Send request: " + client.BaseAddress + url);
+ Debug.Log("[REST][URL] Send request: " + request);
+ }
+ }
+
+ protected void _processResponse(ETSI.ARF.OpenAPI.IHttpClient client, System.Net.Http.HttpResponseMessage response)
+ {
+ lastJsonText = response.Content.ReadAsStringAsync().Result.ToString();
+ lastPayload = response.Content.Headers.ContentLength.Value;
+
+ var status_ = (int)response.StatusCode;
+
+ if (EnableClientLog)
+ {
+ Debug.Log("[REST][Data] Status: " + status_ + " Response: " + client.BaseAddress + " Len: " + lastPayload + " JSON: " + lastJsonText);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Runtime/Scripts/OpenAPI/BaseClient.cs.meta b/Runtime/Scripts/OpenAPI/BaseClient.cs.meta
new file mode 100644
index 0000000000000000000000000000000000000000..d0fa65b74142f62c9658bf318199fef6d72addd7
--- /dev/null
+++ b/Runtime/Scripts/OpenAPI/BaseClient.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 2e0af995ecbb4654a9191f8157a1cf0e
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Runtime/Scripts/OpenAPI/DataModels.cs b/Runtime/Scripts/OpenAPI/DataModels.cs
index d017018f2a55c03d3380daaf4354d6c8d5d1a32e..17f60fe6c81016924d7cfa342f705fcf1a7c74ab 100644
--- a/Runtime/Scripts/OpenAPI/DataModels.cs
+++ b/Runtime/Scripts/OpenAPI/DataModels.cs
@@ -8,6 +8,23 @@ namespace ETSI.ARF.OpenAPI.WorldStorage
public interface IModel
{
public System.Guid UUID { get; set; }
+
+ public string ToJson();
+ }
+
+ // Class to monitor the server
+ public class Server : IModel
+ {
+ public System.Guid UUID { get; set; }
+ public string Name { get; set; }
+
+ public Server(string name)
+ {
+ UUID = Guid.Empty;
+ Name = name;
+ }
+
+ public string ToJson() { return JsonUtility.ToJson(this); }
}
//
@@ -20,6 +37,8 @@ namespace ETSI.ARF.OpenAPI.WorldStorage
UUID = Guid.NewGuid();
Name = name;
}
+
+ public string ToJson() { return JsonUtility.ToJson(this); }
}
public partial class WorldAnchor : IModel
@@ -29,6 +48,8 @@ namespace ETSI.ARF.OpenAPI.WorldStorage
UUID = Guid.NewGuid();
Name = name;
}
+
+ public string ToJson() { return JsonUtility.ToJson(this); }
}
public partial class WorldLink : IModel
@@ -37,5 +58,7 @@ namespace ETSI.ARF.OpenAPI.WorldStorage
{
UUID = Guid.NewGuid();
}
+
+ public string ToJson() { return JsonUtility.ToJson(this); }
}
}
\ No newline at end of file
diff --git a/Runtime/Scripts/OpenAPI/ResponseObject.cs b/Runtime/Scripts/OpenAPI/ResponseObject.cs
index 4e6ffb7795ceea595d3262d53080a6b6a10ef7aa..2be59dc3ec783355c787f56f871d67f7f195544e 100644
--- a/Runtime/Scripts/OpenAPI/ResponseObject.cs
+++ b/Runtime/Scripts/OpenAPI/ResponseObject.cs
@@ -15,13 +15,26 @@ using UnityEngine;
namespace ETSI.ARF.OpenAPI
{
- public class ResponseObject
+ public class CancelToken
+ {
+ protected CancellationTokenSource tokenSource;
+ protected CancellationToken ct;
+
+ public CancellationToken cancellationToken { get => ct; }
+
+ public void Cancel()
+ {
+ tokenSource.Cancel();
+ }
+ }
+
+ public class ResponseObject : CancelToken
{
// Management stuffs
static int ID = 0;
public int transactionId = 0;
public string message = ""; // custom message, type of data...
-
+
// Time monitoring
public TimeSpan DeltaTime { get => responseTime - requestTime; }
public DateTime requestTime;
@@ -30,34 +43,23 @@ namespace ETSI.ARF.OpenAPI
// Incoming data
public T result;
public int payload; // size of data
-
+
//public string result = ""; // text result
//public object data = null; // custom result
// Callback
public Action> callback;
- // Task cancelllation
- public CancellationToken cancellationToken { get => ct; }
- private CancellationTokenSource tokenSource;
- private CancellationToken ct;
-
public ResponseObject(string msg, Action> func = null)
{
requestTime = DateTime.Now;
- transactionId = ++ID;
message = msg;
-
callback = func;
+ transactionId = ++ID;
tokenSource = new CancellationTokenSource();
ct = tokenSource.Token;
}
-
- public void Cancel()
- {
- tokenSource.Cancel();
- }
}
}
\ No newline at end of file
diff --git a/Runtime/Scripts/OpenAPI/UnityWebRequestHttpClient.cs b/Runtime/Scripts/OpenAPI/UnityWebRequestHttpClient.cs
index 94466cec553cae872c2b684a5ec167c2ad00445c..c70ef4ccb306deaad882ba99514905f87cfce377 100644
--- a/Runtime/Scripts/OpenAPI/UnityWebRequestHttpClient.cs
+++ b/Runtime/Scripts/OpenAPI/UnityWebRequestHttpClient.cs
@@ -1,3 +1,23 @@
+//
+// ARF - Augmented Reality Framework (ETSI ISG ARF)
+//
+// Copyright 2024 ETSI
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// Last change: June 2024
+//
+
// Depends on UniTask to support cancellation token and GetAwaiter: https://github.com/Cysharp/UniTask
// Otherwise, the code can be adapted using https://gist.github.com/krzys-h/9062552e33dd7bd7fe4a6c12db109a1a
diff --git a/Runtime/Scripts/OpenAPI/WorldStorageClient.cs b/Runtime/Scripts/OpenAPI/WorldStorageClient.cs
index fd665702cc48024042328416b67a8bc5fec99adf..55a043e234518aa6cf49e10ba8f6f17b216f0c9d 100644
--- a/Runtime/Scripts/OpenAPI/WorldStorageClient.cs
+++ b/Runtime/Scripts/OpenAPI/WorldStorageClient.cs
@@ -1,23 +1,3 @@
-//
-// ARF - Augmented Reality Framework (ETSI ISG ARF)
-//
-// Copyright 2024 ETSI
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-// Last change: March 2024
-//
-
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@@ -25,28 +5,24 @@ using UnityEngine.Networking;
namespace ETSI.ARF.OpenAPI.WorldStorage
{
- // SylR
- public partial class WorldStorageClient
+ ///
+ /// Catch the pre/pos request methods from the autogenerated classes
+ ///
+ public partial class WorldStorageClient : BaseClient
{
- public string lastJsonText;
- public long lastPayload;
-
- partial void PrepareRequest(IHttpClient client, System.Net.Http.HttpRequestMessage request, string url)
+ partial void PrepareRequest(ETSI.ARF.OpenAPI.IHttpClient client, System.Net.Http.HttpRequestMessage request, string url)
{
- // If needed to make some special things !!!
+ _prepareRequest(client, request, url);
}
- partial void PrepareRequest(IHttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder)
+ partial void PrepareRequest(ETSI.ARF.OpenAPI.IHttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder)
{
// do something...
}
- partial void ProcessResponse(IHttpClient client, System.Net.Http.HttpResponseMessage response)
+ partial void ProcessResponse(ETSI.ARF.OpenAPI.IHttpClient client, System.Net.Http.HttpResponseMessage response)
{
- lastJsonText = response.Content.ReadAsStringAsync().Result.ToString();
- lastPayload = response.Content.Headers.ContentLength.Value;
-
- // If needed to make some special things !!!
+ _processResponse(client, response);
}
}
}
\ No newline at end of file
diff --git a/Runtime/Scripts/WorldStorageInfo.cs b/Runtime/Scripts/WorldStorageInfo.cs
index 83421b56e3a4d9647016f8b7ea28383a8c1de5ea..ad815822d3f4bf30e0823d6221196c515dde424c 100644
--- a/Runtime/Scripts/WorldStorageInfo.cs
+++ b/Runtime/Scripts/WorldStorageInfo.cs
@@ -1,7 +1,7 @@
//
// ARF - Augmented Reality Framework (ETSI ISG ARF)
//
-// Copyright 2022 ETSI
+// Copyright 2024 ETSI
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
diff --git a/Runtime/Scripts/WorldStorageUnityHelper.cs b/Runtime/Scripts/WorldStorageUnityHelper.cs
new file mode 100644
index 0000000000000000000000000000000000000000..0a5478e3e31787ace1d7c541380cd4cece64adfd
--- /dev/null
+++ b/Runtime/Scripts/WorldStorageUnityHelper.cs
@@ -0,0 +1,25 @@
+using ETSI.ARF.OpenAPI.WorldStorage;
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class WorldStorageUnityHelper
+{
+ ///
+ /// Convert a float array of length 16 to a Matrix
+ ///
+ /// the values to convert
+ /// Converted Unity Matrix
+ 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;
+ }
+}
diff --git a/Runtime/Scripts/WorldStorageUnityHelper.cs.meta b/Runtime/Scripts/WorldStorageUnityHelper.cs.meta
new file mode 100644
index 0000000000000000000000000000000000000000..8ef5dba1b9d7eb2c186384cf6445b6a4cbfea7af
--- /dev/null
+++ b/Runtime/Scripts/WorldStorageUnityHelper.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: dc92958843a03644e8524fd2312c3f42
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Runtime/Scripts/csc.rsp.meta b/Runtime/Scripts/csc.rsp.meta
index 8c857945de052080f02c7f65a50f031fd8bea918..773242b67e96c56d5e6a23bbe2a1add2b20a775f 100644
--- a/Runtime/Scripts/csc.rsp.meta
+++ b/Runtime/Scripts/csc.rsp.meta
@@ -1,5 +1,5 @@
fileFormatVersion: 2
-guid: a94d6effd437d7842907e9a5cfd2732f
+guid: 7cf3a1fe1b3964e41afa78147db793b0
DefaultImporter:
externalObjects: {}
userData: