diff --git a/README.md b/README.md index c2f6bae3555e19f1d03ba69b5d663ea8120e1e52..a6c65e28de349595426bc12c21e34110e49e7f89 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,34 @@ What you need: 2. Installed openapi generator with npm: https://openapi-generator.tech/docs/installation/ 3. Optional: Installed docker (recommanded): https://www.docker.com/get-started +## Auto-generate client code for WS + +Use/define following setup for the config file `openapitools.json`: + +``` +{ + "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", + "spaces": 2, + "generator-cli": { + "version": "7.6.0", + "generators":{ + "python": { + "generatorName": "python", + "output": "./generated_wa_client", + "inputSpec": "./openapi/API/worldanalysis/worldanalysisopenapi.yaml", + "additionalProperties": { + "packageName": "ETSI.ARF.OpenAPI.WorldAnalysis" + } + } + } + } +} +``` + +Open a command shell and execute: +``` + npx openapi-generator-cli generate +``` ## Installing the python module on your local computer @@ -40,7 +68,21 @@ conda create -n openapi conda activate openapi ``` -Install the common apckae for async WebSockets: +Install the World Analysis OpenAPI: + +``` +pip install .\generated_wa_client +``` + +In case of not having the pip installed for your cml you can use following line: + +``` +py -m pip install .\generated_wa_client +``` + +## Installing the python module for WebSockets on your local computer + +Install the common package for async WebSockets: ``` pip install websockets diff --git a/openapi b/openapi index 073fd7213fd9e6ebc2f8a47d628a650de30c8bc4..7e50e43e90a8dcd958944e8e9ceda05c7668db48 160000 --- a/openapi +++ b/openapi @@ -1 +1 @@ -Subproject commit 073fd7213fd9e6ebc2f8a47d628a650de30c8bc4 +Subproject commit 7e50e43e90a8dcd958944e8e9ceda05c7668db48 diff --git a/wrapper/c#/WorldAnalysisWrapper/Access/WorldStorageServer.cs b/wrapper/c#/WorldAnalysisWrapper/Access/WorldStorageServer.cs new file mode 100644 index 0000000000000000000000000000000000000000..c39c53f4105f844a85c528a2d94cef88c292706c --- /dev/null +++ b/wrapper/c#/WorldAnalysisWrapper/Access/WorldStorageServer.cs @@ -0,0 +1,34 @@ +// +// 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 +// + +namespace ETSI.ARF.WorldStorage +{ + public class WorldStorageServer + { + public string serverName = "myServerName"; + public string company = ""; + public string basePath = "https://"; + public int port = 8080; + + public WorldStorageUser currentUser = null; + + public string URI => port == 0 ? basePath : basePath + ":" + port.ToString(); + } +} \ No newline at end of file diff --git a/wrapper/c#/WorldAnalysisWrapper/Access/WorldStorageUser.cs b/wrapper/c#/WorldAnalysisWrapper/Access/WorldStorageUser.cs new file mode 100644 index 0000000000000000000000000000000000000000..b5dae43aa33bc3fcc3c85a6d179e7d0ee18c6e79 --- /dev/null +++ b/wrapper/c#/WorldAnalysisWrapper/Access/WorldStorageUser.cs @@ -0,0 +1,29 @@ +// +// 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 +// + +namespace ETSI.ARF.WorldStorage +{ + public class WorldStorageUser + { + public string userName = "myName"; + public string company = ""; + public string UUID = System.Guid.Empty.ToString(); + } +} \ No newline at end of file diff --git a/wrapper/c#/WorldAnalysisWrapper/OpenAPI/WorldAnalysis/BaseClient.cs b/wrapper/c#/WorldAnalysisWrapper/OpenAPI/WorldAnalysis/BaseClient.cs new file mode 100644 index 0000000000000000000000000000000000000000..9ba559368b7b73daff2f3fe750c1f5c9d02256b3 --- /dev/null +++ b/wrapper/c#/WorldAnalysisWrapper/OpenAPI/WorldAnalysis/BaseClient.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace ETSI.ARF.OpenAPI.WorldAnalysis +{ + /// + /// Simple class to debug the requests + /// + public class BaseClient + { + static public bool EnableClientLog = true; + public string lastJsonText; + public long lastPayload; + + protected void _prepareRequest(ETSI.ARF.OpenAPI.WorldAnalysis.IHttpClient client, System.Net.Http.HttpRequestMessage request, string url) + { + if (EnableClientLog) + { + Console.WriteLine("[REST][URL] Send request: " + client.BaseAddress + url); + Console.WriteLine("[REST][URL] Send request: " + request); + } + } + + protected void _processResponse(ETSI.ARF.OpenAPI.WorldAnalysis.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) + { + Console.WriteLine("[REST][Data] Status: " + status_ + " Response: " + client.BaseAddress + " Len: " + lastPayload + " JSON: " + lastJsonText); + } + } + } +} \ No newline at end of file diff --git a/wrapper/c#/WorldAnalysisWrapper/OpenAPI/WorldAnalysis/DataModels.cs b/wrapper/c#/WorldAnalysisWrapper/OpenAPI/WorldAnalysis/DataModels.cs new file mode 100644 index 0000000000000000000000000000000000000000..9320ae96e5263a2705ac2103e7b3cdd02d6d5551 --- /dev/null +++ b/wrapper/c#/WorldAnalysisWrapper/OpenAPI/WorldAnalysis/DataModels.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Numerics; +using Newtonsoft.Json; + +namespace ETSI.ARF.OpenAPI.WorldAnalysis +{ + public interface IModel + { + public System.Guid Uuid { get; set; } // Bug: SylR: Why is Uuid not capitalized (UUID)??? + + 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 JsonConvert.SerializeObject(this); } + } + + // + // Implement here some constructors + // + public partial class Pose : IModel + { + public Pose() + { + Uuid = Guid.NewGuid(); + } + + public string ToJson() { return JsonConvert.SerializeObject(this); } + } + + public partial class Transform3D + { + public Matrix4x4 Matrix() + { + return new Matrix4x4( + this[0], this[1], this[2], this[3], + this[4], this[5], this[6], this[7], + this[8], this[9], this[10], this[11], + this[12], this[13], this[14], this[15] + ); + } + } +} \ No newline at end of file diff --git a/wrapper/c#/WorldAnalysisWrapper/OpenAPI/WorldAnalysis/ResponseObject.cs b/wrapper/c#/WorldAnalysisWrapper/OpenAPI/WorldAnalysis/ResponseObject.cs new file mode 100644 index 0000000000000000000000000000000000000000..1344360fe41d07cbd5ed371c3acfaa9d0777ee2f --- /dev/null +++ b/wrapper/c#/WorldAnalysisWrapper/OpenAPI/WorldAnalysis/ResponseObject.cs @@ -0,0 +1,64 @@ +// The Fraunhofer HHI Unity Framework +// ___________ .__ _____ ___ ___ ___ ___ .___ +// \_ _____/___________ __ __ ____ | |__ _____/ ____\___________ / | \ / | \| | +// | __) \_ __ \__ \ | | \/ \| | \ / _ \ __\/ __ \_ __ \ / ~ \/ ~ \ | +// | \ | | \// __ \| | / | \ Y ( <_> ) | \ ___/| | \/ \ Y /\ Y / | +// \___ / |__| (____ /____/|___| /___| /\____/|__| \___ >__| \___|_ / \___|_ /|___| +// \/ \/ \/ \/ \/ \/ \/ +// (C) Fraunhofer HHI, 2024 + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Threading; + +namespace ETSI.ARF.OpenAPI.WorldAnalysis +{ + 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; + public DateTime responseTime; + + // 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; + + + public ResponseObject(string msg, Action> func = null) + { + requestTime = DateTime.Now; + message = msg; + callback = func; + transactionId = ++ID; + + tokenSource = new CancellationTokenSource(); + ct = tokenSource.Token; + } + } +} \ No newline at end of file diff --git a/wrapper/c#/WorldAnalysisWrapper/OpenAPI/WorldAnalysis/UnityWebRequestHttpClient.cs b/wrapper/c#/WorldAnalysisWrapper/OpenAPI/WorldAnalysis/UnityWebRequestHttpClient.cs new file mode 100644 index 0000000000000000000000000000000000000000..b3bc2e1a85a85a7374a45cd9e7dbc1aab413e81a --- /dev/null +++ b/wrapper/c#/WorldAnalysisWrapper/OpenAPI/WorldAnalysis/UnityWebRequestHttpClient.cs @@ -0,0 +1,81 @@ +// +// 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: September 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 + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Threading; +using System.Threading.Tasks; +//using Cysharp.Threading.Tasks; + +namespace ETSI.ARF.OpenAPI.WorldAnalysis +{ + public interface IHttpClient + { + public Uri BaseAddress { get; set; } + public HttpRequestHeaders DefaultRequestHeaders { get; } + + public Task SendAsync(HttpRequestMessage message, HttpCompletionOption option, + CancellationToken token); + + public void Dispose(); + } + + public class BasicHTTPClient : IHttpClient + { + + public BasicHTTPClient() { } + + public BasicHTTPClient(string baseUri) + { + BaseAddress = new Uri(baseUri); + _httpClient.BaseAddress = BaseAddress; + } + + public BasicHTTPClient(Uri baseUri) + { + BaseAddress = baseUri; + _httpClient.BaseAddress = BaseAddress; + } + + public Uri BaseAddress { get; set; } + public HttpRequestHeaders DefaultRequestHeaders => _httpClient.DefaultRequestHeaders; + + private readonly HttpClient _httpClient = new HttpClient(); + + public async Task SendAsync(HttpRequestMessage message, HttpCompletionOption option, CancellationToken token) + { + return await _httpClient.SendAsync(message, option, token); + } + + public void Dispose() + { + _httpClient.Dispose(); + DefaultRequestHeaders.Clear(); + BaseAddress = null; + } + } +} \ No newline at end of file diff --git a/wrapper/c#/WorldAnalysisWrapper/OpenAPI/WorldAnalysis/WorldAnalysisClient.cs b/wrapper/c#/WorldAnalysisWrapper/OpenAPI/WorldAnalysis/WorldAnalysisClient.cs new file mode 100644 index 0000000000000000000000000000000000000000..126c78ddafa0f240dd659f8d463018168bdacf97 --- /dev/null +++ b/wrapper/c#/WorldAnalysisWrapper/OpenAPI/WorldAnalysis/WorldAnalysisClient.cs @@ -0,0 +1,26 @@ +using System.Collections; +using System.Collections.Generic; + +namespace ETSI.ARF.OpenAPI.WorldAnalysis +{ + /// + /// Catch the pre/pos request methods from the autogenerated classes + /// + public partial class WorldAnalysisClient : BaseClient + { + partial void PrepareRequest(ETSI.ARF.OpenAPI.WorldAnalysis.IHttpClient client, System.Net.Http.HttpRequestMessage request, string url) + { + _prepareRequest(client, request, url); + } + + partial void PrepareRequest(ETSI.ARF.OpenAPI.WorldAnalysis.IHttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder) + { + // do something... + } + + partial void ProcessResponse(ETSI.ARF.OpenAPI.WorldAnalysis.IHttpClient client, System.Net.Http.HttpResponseMessage response) + { + _processResponse(client, response); + } + } +} \ No newline at end of file diff --git a/wrapper/c#/WorldAnalysisWrapper/OpenAPI/WorldStorage/BaseClient.cs b/wrapper/c#/WorldAnalysisWrapper/OpenAPI/WorldStorage/BaseClient.cs new file mode 100644 index 0000000000000000000000000000000000000000..765563f022ebb7717e105d3284fc2ca386463102 --- /dev/null +++ b/wrapper/c#/WorldAnalysisWrapper/OpenAPI/WorldStorage/BaseClient.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections; +using System.Collections.Generic; + +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.WorldStorage.IHttpClient client, System.Net.Http.HttpRequestMessage request, string url) + { + if (EnableClientLog) + { + Console.WriteLine("[REST][URL] Send request: " + client.BaseAddress + url); + Console.WriteLine("[REST][URL] Send request: " + request); + } + } + + protected void _processResponse(ETSI.ARF.OpenAPI.WorldStorage.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) + { + Console.WriteLine("[REST][Data] Status: " + status_ + " Response: " + client.BaseAddress + " Len: " + lastPayload + " JSON: " + lastJsonText); + } + } + } +} \ No newline at end of file diff --git a/wrapper/c#/WorldAnalysisWrapper/OpenAPI/WorldStorage/DataModels.cs b/wrapper/c#/WorldAnalysisWrapper/OpenAPI/WorldStorage/DataModels.cs new file mode 100644 index 0000000000000000000000000000000000000000..f3305108c07fa4f33f815b6cdfe853df44633bfc --- /dev/null +++ b/wrapper/c#/WorldAnalysisWrapper/OpenAPI/WorldStorage/DataModels.cs @@ -0,0 +1,78 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Numerics; +using Newtonsoft.Json; + +namespace ETSI.ARF.OpenAPI.WorldStorage +{ + public partial class Transform3D + { + public Matrix4x4 Matrix() + { + return new Matrix4x4( + this[0], this[1], this[2], this[3], + this[4], this[5], this[6], this[7], + this[8], this[9], this[10], this[11], + this[12], this[13], this[14], this[15] + ); + } + } + + 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 JsonConvert.SerializeObject(this); } + } + + // + // Implement here some constructors + // + public partial class Trackable : IModel + { + public Trackable(string name) + { + UUID = Guid.NewGuid(); + Name = name; + } + + public string ToJson() { return JsonConvert.SerializeObject(this); } + } + + public partial class WorldAnchor : IModel + { + public WorldAnchor(string name) + { + UUID = Guid.NewGuid(); + Name = name; + } + + public string ToJson() { return JsonConvert.SerializeObject(this); } + } + + public partial class WorldLink : IModel + { + public WorldLink() + { + UUID = Guid.NewGuid(); + } + + public string ToJson() { return JsonConvert.SerializeObject(this); } + } +} \ No newline at end of file diff --git a/wrapper/c#/WorldAnalysisWrapper/OpenAPI/WorldStorage/ResponseObject.cs b/wrapper/c#/WorldAnalysisWrapper/OpenAPI/WorldStorage/ResponseObject.cs new file mode 100644 index 0000000000000000000000000000000000000000..40165ff4053e6515fffd80bc7720e51825b42abc --- /dev/null +++ b/wrapper/c#/WorldAnalysisWrapper/OpenAPI/WorldStorage/ResponseObject.cs @@ -0,0 +1,64 @@ +// The Fraunhofer HHI Unity Framework +// ___________ .__ _____ ___ ___ ___ ___ .___ +// \_ _____/___________ __ __ ____ | |__ _____/ ____\___________ / | \ / | \| | +// | __) \_ __ \__ \ | | \/ \| | \ / _ \ __\/ __ \_ __ \ / ~ \/ ~ \ | +// | \ | | \// __ \| | / | \ Y ( <_> ) | \ ___/| | \/ \ Y /\ Y / | +// \___ / |__| (____ /____/|___| /___| /\____/|__| \___ >__| \___|_ / \___|_ /|___| +// \/ \/ \/ \/ \/ \/ \/ +// (C) Fraunhofer HHI, 2024 + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Threading; + +namespace ETSI.ARF.OpenAPI.WorldStorage +{ + 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; + public DateTime responseTime; + + // 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; + + + public ResponseObject(string msg, Action> func = null) + { + requestTime = DateTime.Now; + message = msg; + callback = func; + transactionId = ++ID; + + tokenSource = new CancellationTokenSource(); + ct = tokenSource.Token; + } + } +} \ No newline at end of file diff --git a/wrapper/c#/WorldAnalysisWrapper/OpenAPI/WorldStorage/UnityWebRequestHttpClient.cs b/wrapper/c#/WorldAnalysisWrapper/OpenAPI/WorldStorage/UnityWebRequestHttpClient.cs new file mode 100644 index 0000000000000000000000000000000000000000..1cc6cf5d1f6d728bb99e756dc66e94a3dd4f7120 --- /dev/null +++ b/wrapper/c#/WorldAnalysisWrapper/OpenAPI/WorldStorage/UnityWebRequestHttpClient.cs @@ -0,0 +1,81 @@ +// +// 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: September 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 + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Threading; +using System.Threading.Tasks; +//using Cysharp.Threading.Tasks; + +namespace ETSI.ARF.OpenAPI.WorldStorage +{ + public interface IHttpClient + { + public Uri BaseAddress { get; set; } + public HttpRequestHeaders DefaultRequestHeaders { get; } + + public Task SendAsync(HttpRequestMessage message, HttpCompletionOption option, + CancellationToken token); + + public void Dispose(); + } + + public class BasicHTTPClient : IHttpClient + { + + public BasicHTTPClient() { } + + public BasicHTTPClient(string baseUri) + { + BaseAddress = new Uri(baseUri); + _httpClient.BaseAddress = BaseAddress; + } + + public BasicHTTPClient(Uri baseUri) + { + BaseAddress = baseUri; + _httpClient.BaseAddress = BaseAddress; + } + + public Uri BaseAddress { get; set; } + public HttpRequestHeaders DefaultRequestHeaders => _httpClient.DefaultRequestHeaders; + + private readonly HttpClient _httpClient = new HttpClient(); + + public async Task SendAsync(HttpRequestMessage message, HttpCompletionOption option, CancellationToken token) + { + return await _httpClient.SendAsync(message, option, token); + } + + public void Dispose() + { + _httpClient.Dispose(); + DefaultRequestHeaders.Clear(); + BaseAddress = null; + } + } +} \ No newline at end of file diff --git a/wrapper/c#/WorldAnalysisWrapper/OpenAPI/WorldStorage/WorldStorageClient.cs b/wrapper/c#/WorldAnalysisWrapper/OpenAPI/WorldStorage/WorldStorageClient.cs new file mode 100644 index 0000000000000000000000000000000000000000..4cd88a7409d1a789b95498aa1d8e21a62df43328 --- /dev/null +++ b/wrapper/c#/WorldAnalysisWrapper/OpenAPI/WorldStorage/WorldStorageClient.cs @@ -0,0 +1,26 @@ +using System.Collections; +using System.Collections.Generic; + +namespace ETSI.ARF.OpenAPI.WorldStorage +{ + /// + /// Catch the pre/pos request methods from the autogenerated classes + /// + public partial class WorldStorageClient : BaseClient + { + partial void PrepareRequest(ETSI.ARF.OpenAPI.WorldStorage.IHttpClient client, System.Net.Http.HttpRequestMessage request, string url) + { + _prepareRequest(client, request, url); + } + + partial void PrepareRequest(ETSI.ARF.OpenAPI.WorldStorage.IHttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder) + { + // do something... + } + + partial void ProcessResponse(ETSI.ARF.OpenAPI.WorldStorage.IHttpClient client, System.Net.Http.HttpResponseMessage response) + { + _processResponse(client, response); + } + } +} \ No newline at end of file diff --git a/wrapper/c#/WorldAnalysisWrapper/Program.cs b/wrapper/c#/WorldAnalysisWrapper/Program.cs new file mode 100644 index 0000000000000000000000000000000000000000..e3db13b127f107885df93b5b75f4b9124689a53e --- /dev/null +++ b/wrapper/c#/WorldAnalysisWrapper/Program.cs @@ -0,0 +1,62 @@ +using System; +using System.Collections.Generic; + +namespace WorldAnalysisWrapper +{ + class Program + { + static public bool isDev = true; + static bool isDev_Secure = true; + static bool isLocalNetwork = true; + + static public WorldAnalysis module; + + // + // Web server (World Storage) + // + static private string webserver_url; + + // + // WebSocket server (World Analysis) + // + static private string websocket_url; + + static void Main(string[] args) + { + // + // Web server + // + // for production + webserver_url = "https://etsi.hhi.fraunhofer.de"; // public + + // + // WebSockets + // + + if (isDev) + { + // For development + + if (isDev_Secure) websocket_url = "wss://localhost:44301/ws"; // secure + else websocket_url = "ws://localhost:61788/ws"; + } + else + { + // For production + + if (isLocalNetwork) websocket_url = "ws://192.168.20.29:8084/ws"; // local network + else websocket_url = "wss://analysis.etsi.hhi.fraunhofer.de"; // public + } + + + Console.WriteLine("Starting World Analysis module..."); + module = new WorldAnalysis(webserver_url, websocket_url, 2); + module.Start(); + + while (module.isRunning()) + { + // don't exit here, wait! + } + } + } +} diff --git a/wrapper/c#/WorldAnalysisWrapper/REST/AdminRequest.cs b/wrapper/c#/WorldAnalysisWrapper/REST/AdminRequest.cs new file mode 100644 index 0000000000000000000000000000000000000000..47665bf54397f6df1868e0ef73ed4d0f08fe8fc3 --- /dev/null +++ b/wrapper/c#/WorldAnalysisWrapper/REST/AdminRequest.cs @@ -0,0 +1,65 @@ +// +// 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; +using System.Threading.Tasks; + +using ETSI.ARF.OpenAPI; +using ETSI.ARF.OpenAPI.WorldStorage; + +namespace ETSI.ARF.WorldStorage.REST +{ + public class AdminRequest : RequestBase + { + // + // Wrapper for the endpoints + // + static public string PingSync(WorldStorageServer ws) + { + wsServer = ws; + var httpClient = new BasicHTTPClient(ws.URI); + apiClient = new WorldStorageClient(httpClient); + + string response = apiClient.GetPing(); + return response; + } + + static public string AdminSync(WorldStorageServer ws) + { + wsServer = ws; + var httpClient = new BasicHTTPClient(ws.URI); + apiClient = new WorldStorageClient(httpClient); + + string response = apiClient.GetAdmin(); + return response; + } + + + static public string VersionSync(WorldStorageServer ws) + { + wsServer = ws; + var httpClient = new BasicHTTPClient(ws.URI); + apiClient = new WorldStorageClient(httpClient); + + string response = apiClient.GetVersion(); + return response; + } + } +} diff --git a/wrapper/c#/WorldAnalysisWrapper/REST/RelocalizationInformationRequest.cs b/wrapper/c#/WorldAnalysisWrapper/REST/RelocalizationInformationRequest.cs new file mode 100644 index 0000000000000000000000000000000000000000..2b96de80e0ee3b5beb99c978ba9baa183cf0f848 --- /dev/null +++ b/wrapper/c#/WorldAnalysisWrapper/REST/RelocalizationInformationRequest.cs @@ -0,0 +1,204 @@ +// +// 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: September 2024 +// +using System; +using System.Collections.Generic; +using ETSI.ARF.OpenAPI.WorldStorage; +using ETSI.ARF.OpenAPI; +using Newtonsoft.Json; + +namespace ETSI.ARF.WorldStorage.REST +{ + public class RelocalizationInformationRequest : RequestBase + { + static public RelocalizationInformations GetRelocalizationInformation(WorldStorageServer ws, List uuids, List modes, List capabilities) + { + return GetRelocalizationInformationSync(ws, uuids, modes, capabilities); + } + + static public RelocalizationInformations GetRelocalizationInformationSync(WorldStorageServer ws, List uuids, List modes, List capabilities) + { + wsServer = ws; + var httpClient = new BasicHTTPClient(ws.URI); + apiClient = new MyWorldStorageClient(httpClient); + + + List anonymous = new List(); + for (int i = 0; i < uuids.Count; i++) + { + // Check same size or give anonymous as parameter? + UuidAndMode newOne = new UuidAndMode(); + newOne.Uuid = uuids[i]; + newOne.Mode = modes[i]; + anonymous.Add(newOne); + } + + RelocalizationInformations ro = apiClient.GetRelocalizationInformation(token, anonymous, capabilities); + return ro; + } + } +} + +namespace ETSI.ARF.OpenAPI.WorldStorage +{ + public partial class WorldStorageClient + { + public ETSI.ARF.OpenAPI.WorldStorage.IHttpClient GetHttpClient() + { + return _httpClient; + } + + public string ConvertToString_(object value, System.Globalization.CultureInfo cultureInfo) + { + return ConvertToString(value, cultureInfo); + } + + + public void PrepareRequest_(ETSI.ARF.OpenAPI.WorldStorage.IHttpClient client, System.Net.Http.HttpRequestMessage request, string url) + { + PrepareRequest(client, request, url); + } + public void PrepareRequest_(ETSI.ARF.OpenAPI.WorldStorage.IHttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder) + { + PrepareRequest(client, request, urlBuilder); + } + public void ProcessResponse_(ETSI.ARF.OpenAPI.WorldStorage.IHttpClient client, System.Net.Http.HttpResponseMessage response) + { + ProcessResponse(client, response); + } + } + + // Custom client to be able to properly serialize objects in the query string + public partial class MyWorldStorageClient : WorldStorageClient + { + public MyWorldStorageClient(IHttpClient httpClient) : base(httpClient) + { + } + + /// + /// Override Nswag generated function to access relocalization information : deal with parameters in the query + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public override async System.Threading.Tasks.Task GetRelocalizationInformationAsync(string token, System.Collections.Generic.IEnumerable uuids, System.Collections.Generic.IEnumerable capabilities, System.Threading.CancellationToken cancellationToken) + { + if (uuids == null) + throw new System.ArgumentNullException("uuids"); + + if (capabilities == null) + throw new System.ArgumentNullException("capabilities"); + + var client_ = GetHttpClient(); + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + + if (token != null) + request_.Headers.TryAddWithoutValidation("token", ConvertToString_(token, System.Globalization.CultureInfo.InvariantCulture)); + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + urlBuilder_.Append("relocalizationInformation"); + urlBuilder_.Append('?'); + foreach (var item_ in uuids) { urlBuilder_.Append(System.Uri.EscapeDataString("uuids")).Append('=').Append(System.Uri.EscapeDataString(JsonConvert.SerializeObject(item_))).Append('&'); } + foreach (var item_ in capabilities) { urlBuilder_.Append(System.Uri.EscapeDataString("capabilities")).Append('=').Append(System.Uri.EscapeDataString(JsonConvert.SerializeObject(item_))).Append('&'); } + urlBuilder_.Length--; + + PrepareRequest_(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest_(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse_(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + var result_ = (string)System.Convert.ChangeType(responseData_, typeof(string)); + throw new ApiException("Invalid UUID supplied.", status_, responseData_, headers_, result_, null); + } + else + if (status_ == 404) + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + var result_ = (string)System.Convert.ChangeType(responseData_, typeof(string)); + throw new ApiException("Not found, could not find UUID in database.", status_, responseData_, headers_, result_, null); + } + else + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Unexpected error.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + } +} \ No newline at end of file diff --git a/wrapper/c#/WorldAnalysisWrapper/REST/RequestBase.cs b/wrapper/c#/WorldAnalysisWrapper/REST/RequestBase.cs new file mode 100644 index 0000000000000000000000000000000000000000..c1012fefb2572220a1de6c7beda9a62bf5927d9b --- /dev/null +++ b/wrapper/c#/WorldAnalysisWrapper/REST/RequestBase.cs @@ -0,0 +1,129 @@ +// +// 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: September 2024 +// + +using System; +using System.Threading.Tasks; +using System.Collections.Generic; + +using ETSI.ARF.OpenAPI; +using ETSI.ARF.OpenAPI.WorldStorage; + +namespace ETSI.ARF.WorldStorage.REST +{ + public class RequestBase // where T : Trackable, WorldAnchor, WorldLink + { + static protected WorldStorageServer wsServer; + static protected WorldStorageClient apiClient; + + static protected string token = "dev"; // only for development + + // Cache the current list + static public Dictionary listOfObjects = new Dictionary(); + + + // + // Helpers + // + static protected void OnReceiveObject(Task t, object id) + { + if (t.IsCompleted) + { + ResponseObject o = (ResponseObject)id; + o.responseTime = DateTime.Now; + o.result = t.Result; + Console.WriteLine($"[REST] Server Response = {o.result.ToString()} (ID={o.transactionId}, Msg={o.message})"); + + o.callback?.Invoke(o); + } + else Console.WriteLine("[REST] OpenAPI Timeout!"); + } + + static protected void OnReceiveListOfObjects(Task t, object id) // where TObj : IModel + { + if (t.IsCompleted) + { + ResponseObject o = (ResponseObject)id; + o.responseTime = DateTime.Now; + o.result = t.Result; + Console.WriteLine($"[REST] " + o.result.GetType()); + + // Adapation for new API, SylR + int cnt = 0; + + // Remember the new list + listOfObjects.Clear(); + + // Get the new list + if (o.result.GetType() == typeof(TrackablesResponse)) + { + Console.WriteLine($"[REST] TR"); + TrackablesResponse res = o.result as TrackablesResponse; + foreach (var item in res.Trackables) + { + listOfObjects.Add(item.UUID, item); + cnt++; + } + } + else if (o.GetType() == typeof(WorldAnchorsResponse)) + { + WorldAnchorsResponse res = o as WorldAnchorsResponse; + foreach (var item in res.WorldAnchors) + { + listOfObjects.Add(item.UUID, item); + cnt++; + } + } + else if (o.GetType() == typeof(WorldLinksResponse)) + { + WorldLinksResponse res = o as WorldLinksResponse; + foreach (var item in res.WorldLinks) + { + listOfObjects.Add(item.UUID, item); + cnt++; + } + } + + Console.WriteLine($"[REST] Server Response = Got {cnt} entrie(s) (ID={o.transactionId}, Msg={o.message})"); + o.callback?.Invoke(o); + } + else Console.WriteLine("[REST] OpenAPI Timeout!"); + } + + static protected void old_OnReceiveListOfObjects(Task> t, object id) where TObj : IModel + { + if (t.IsCompleted) + { + ResponseObject> o = (ResponseObject>)id; + o.responseTime = DateTime.Now; + o.result = t.Result; + Console.WriteLine($"[REST] Server Response = Got {o.result.Count} entrie(s) (ID={o.transactionId}, Msg={o.message})"); + + listOfObjects.Clear(); + foreach (var i in o.result) + { + listOfObjects.Add(i.UUID, i); + } + o.callback?.Invoke(o); + } + else Console.WriteLine("[REST] OpenAPI Timeout!"); + } + + } +} diff --git a/wrapper/c#/WorldAnalysisWrapper/REST/TrackableRequest.cs b/wrapper/c#/WorldAnalysisWrapper/REST/TrackableRequest.cs new file mode 100644 index 0000000000000000000000000000000000000000..3ac53ccc6c56a934bdf0c918e4a4b0cff497097d --- /dev/null +++ b/wrapper/c#/WorldAnalysisWrapper/REST/TrackableRequest.cs @@ -0,0 +1,89 @@ +// +// 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 +// + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; + +using ETSI.ARF.OpenAPI; +using ETSI.ARF.OpenAPI.WorldStorage; + +namespace ETSI.ARF.WorldStorage.REST +{ + public class TrackableRequest : RequestBase + { + // + // Wrapper for the endpoints + // + static public Trackable GetTrackableSync(WorldStorageServer ws, Guid UUID) + { + wsServer = ws; + var httpClient = new BasicHTTPClient(ws.URI); + apiClient = new WorldStorageClient(httpClient); + + //Console.WriteLine($"[REST] Request Trackable {UUID}..."); + return apiClient.GetTrackableById(token, UUID); + } + + static public List GetTrackablesSync(WorldStorageServer ws) + { + wsServer = ws; + var httpClient = new BasicHTTPClient(ws.URI); + apiClient = new WorldStorageClient(httpClient); + + Console.WriteLine("[REST] Request Trackables..."); + return apiClient.GetTrackables(token).Trackables as List; + } + + 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"); + + Console.WriteLine($"[REST] Create Trackable {trackable.UUID}..."); + return apiClient.AddTrackable(token, trackable).Message; + } + + static public string UpdateTrackableSync(WorldStorageServer ws, Trackable trackable) + { + wsServer = ws; + var httpClient = new BasicHTTPClient(ws.URI); + apiClient = new WorldStorageClient(httpClient); + + Console.WriteLine($"[REST] Update Trackable {trackable.UUID}..."); + return apiClient.ModifyTrackable(token, trackable).Message; + } + + static public string DeleteTrackableSync(WorldStorageServer ws, Guid UUID) + { + wsServer = ws; + var httpClient = new BasicHTTPClient(ws.URI); + apiClient = new WorldStorageClient(httpClient); + + Console.WriteLine($"[REST] Delete Trackable {UUID}..."); + return apiClient.DeleteTrackable(token, UUID).Message; + } + } +} \ No newline at end of file diff --git a/wrapper/c#/WorldAnalysisWrapper/REST/WorldAnchorRequest.cs b/wrapper/c#/WorldAnalysisWrapper/REST/WorldAnchorRequest.cs new file mode 100644 index 0000000000000000000000000000000000000000..733a71215bb3a154f9538e542c09f192e9997acf --- /dev/null +++ b/wrapper/c#/WorldAnalysisWrapper/REST/WorldAnchorRequest.cs @@ -0,0 +1,91 @@ +// +// 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; +using System.Collections.Generic; +using System.Threading.Tasks; + +using ETSI.ARF.OpenAPI; +using ETSI.ARF.OpenAPI.WorldStorage; + +//#if UNITY_EDITOR +namespace ETSI.ARF.WorldStorage.REST +{ + public class WorldAnchorRequest : RequestBase + { + // + // Wrapper for the endpoints + // + static public WorldAnchor GetWorldAnchorSync(WorldStorageServer ws, Guid UUID) + { + wsServer = ws; + var httpClient = new BasicHTTPClient(ws.URI); + apiClient = new WorldStorageClient(httpClient); + + //Console.WriteLine($"[REST] Request WorldAnchor {UUID}..."); + return apiClient.GetWorldAnchorById(token, UUID); + } + + static public List GetWorldAnchorsSync(WorldStorageServer ws) + { + wsServer = ws; + var httpClient = new BasicHTTPClient(ws.URI); + apiClient = new WorldStorageClient(httpClient); + + Console.WriteLine("[REST] Request WorldAnchors..."); + return apiClient.GetWorldAnchors(token).WorldAnchors as List; + } + + 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"); + + //Console.WriteLine($"[REST] Create WorldAnchor {worldAnchor.UUID}..."); + return apiClient.AddWorldAnchor(token, worldAnchor).Message; + } + + static public string UpdateWorldAnchorSync(WorldStorageServer ws, WorldAnchor worldAnchor) + { + wsServer = ws; + var httpClient = new BasicHTTPClient(ws.URI); + apiClient = new WorldStorageClient(httpClient); + + Console.WriteLine($"[REST] Update WorldAnchor {worldAnchor.UUID}..."); + return apiClient.ModifyWorldAnchor(token, worldAnchor).Message; + } + + static public string DeleteWorldAnchorSync(WorldStorageServer ws, Guid UUID) + { + wsServer = ws; + var httpClient = new BasicHTTPClient(ws.URI); + apiClient = new WorldStorageClient(httpClient); + + Console.WriteLine($"[REST] Delete WorldAnchor {UUID}..."); + return apiClient.DeleteWorldAnchor(token, UUID).Message; + } + } +} +//#endif \ No newline at end of file diff --git a/wrapper/c#/WorldAnalysisWrapper/REST/WorldLinkRequest.cs b/wrapper/c#/WorldAnalysisWrapper/REST/WorldLinkRequest.cs new file mode 100644 index 0000000000000000000000000000000000000000..ed604e7fa74a96b308fd67f97e417fb39e42bf11 --- /dev/null +++ b/wrapper/c#/WorldAnalysisWrapper/REST/WorldLinkRequest.cs @@ -0,0 +1,90 @@ +// +// 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 +// + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; + +using ETSI.ARF.OpenAPI; +using ETSI.ARF.OpenAPI.WorldStorage; + +namespace ETSI.ARF.WorldStorage.REST +{ + public class WorldLinkRequest : RequestBase + { + // + // Wrapper for the endpoints + // + static public WorldLink GetWorldLinkSync(WorldStorageServer ws, Guid UUID) + { + wsServer = ws; + var httpClient = new BasicHTTPClient(ws.URI); + apiClient = new WorldStorageClient(httpClient); + + //Console.WriteLine($"[REST] Request WorldLink {UUID}..."); + return apiClient.GetWorldLinkById(token, UUID); + } + + static public List GetWorldLinksSync(WorldStorageServer ws) + { + wsServer = ws; + var httpClient = new BasicHTTPClient(ws.URI); + apiClient = new WorldStorageClient(httpClient); + + Console.WriteLine("[REST] Request WorldLinks..."); + return apiClient.GetWorldLinks(token).WorldLinks as List; + } + + 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"); + + //Console.WriteLine($"[REST] Create WorldLink {worldLink.UUID}..."); + return apiClient.AddWorldLink(token, worldLink).Message; + } + + static public string UpdateWorldLinkSync(WorldStorageServer ws, WorldLink worldLink) + { + wsServer = ws; + var httpClient = new BasicHTTPClient(ws.URI); + apiClient = new WorldStorageClient(httpClient); + + Console.WriteLine($"[REST] Update WorldLink {worldLink.UUID}..."); + return apiClient.ModifyWorldLink(token, worldLink).Message; + } + + static public string DeleteWorldLinkSync(WorldStorageServer ws, Guid UUID) + { + wsServer = ws; + var httpClient = new BasicHTTPClient(ws.URI); + apiClient = new WorldStorageClient(httpClient); + + Console.WriteLine($"[REST] Delete WorldLink {UUID}..."); + return apiClient.DeleteWorldLink(token, UUID).Message; + } + } +} +//#endif \ No newline at end of file diff --git a/wrapper/c#/WorldAnalysisWrapper/WorldAnalysis.cs b/wrapper/c#/WorldAnalysisWrapper/WorldAnalysis.cs new file mode 100644 index 0000000000000000000000000000000000000000..8bd9acfb9a482a468661decb4ad2c4260de633ce --- /dev/null +++ b/wrapper/c#/WorldAnalysisWrapper/WorldAnalysis.cs @@ -0,0 +1,624 @@ +#define SIMULATE_ANALYSIS +//#define ALWAYS_CALL_REST_API + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +using ETSI.ARF.OpenAPI.WorldStorage; +using ETSI.ARF.OpenAPI.WorldAnalysis; + +using ETSI.ARF.WorldStorage; +using ETSI.ARF.WorldStorage.REST; +using Newtonsoft.Json; +using System.Numerics; + + +namespace WorldAnalysisWrapper +{ + class WorldAnalysis + { + static public List trackables; + static public List anchors; + static public List links; + + float randomScale = 0.01f; // m + + public class SubscriptionInfo + { + public Guid uuidSub; // id of subscription (id is defined by the WA server) + + public SubscriptionSingleRequest subscription; + public Mode_WorldAnalysis mode; + + // Monitor + public int sendCnt; + + // Results + public Pose pose; + public Trackable trackable; + public ETSI.ARF.OpenAPI.WorldStorage.Transform3D transform3d; + + public Trackable extra; + } + + private int simulationDelay = 500; // ms + private string modulename = ""; + private SubscriptionInfo lastSubscription; + private Dictionary subscriptions = new Dictionary(); + + // WS + private ETSI.ARF.OpenAPI.WorldStorage.RelocalizationInformations relocInfos; + + private bool sendPose = false; + + // Credencials + private WorldStorageServer server; + private WorldStorageUser user; + private bool isRegistered = false; + + private WebSocketSharp.WebSocket webSocket; + private bool websocketConnected = false; + private string webserver_url; + private string websocket_url; + + // Capabilities of the module + private ETSI.ARF.OpenAPI.WorldStorage.EncodingInformationStructure enc = null; + private List capabilities = new List(); + + + public WorldAnalysis(string webserver, string websocket, int mode) + { + webserver_url = webserver; + websocket_url = websocket; + ETSI.ARF.OpenAPI.WorldStorage.Capability cap = null; + + // Simulate a World Analysis module + if (mode == 1) + { + modulename = "HHI-ImageTracker"; + + enc = new ETSI.ARF.OpenAPI.WorldStorage.EncodingInformationStructure() + { + Version = "HHI-0.1.0", // version + DataFormat = ETSI.ARF.OpenAPI.WorldStorage.EncodingInformationStructureDataFormat.OTHER // type/company? + }; + + // Capability #1 + cap = new ETSI.ARF.OpenAPI.WorldStorage.Capability(); + cap.TrackableType = ETSI.ARF.OpenAPI.WorldStorage.TrackableType.IMAGE_MARKER; + cap.EncodingInformation = enc; + cap.Framerate = 30; + cap.Latency = 0.05; + cap.Accuracy = 01; + capabilities.Add(cap); + } + else if (mode == 2) + { + modulename = "HHI-MapAndMesh-Detection"; + + enc = new ETSI.ARF.OpenAPI.WorldStorage.EncodingInformationStructure() + { + Version = "HHI-0.1.2", // version + DataFormat = ETSI.ARF.OpenAPI.WorldStorage.EncodingInformationStructureDataFormat.OTHER // type/company? + }; + + // Capability #1 + cap = new ETSI.ARF.OpenAPI.WorldStorage.Capability(); + cap.TrackableType = ETSI.ARF.OpenAPI.WorldStorage.TrackableType.MAP; + cap.EncodingInformation = enc; + cap.Framerate = 6; + cap.Latency = 0.5; + cap.Accuracy = 0.8; + capabilities.Add(cap); + + // Capability #2 + cap = new ETSI.ARF.OpenAPI.WorldStorage.Capability(); + cap.TrackableType = ETSI.ARF.OpenAPI.WorldStorage.TrackableType.MESH; + cap.EncodingInformation = enc; + cap.Framerate = 8; + cap.Latency = 0.5; + cap.Accuracy = 0.9; + capabilities.Add(cap); + } + + // + // REST + // + + // Test the REST World Storage API + server = new WorldStorageServer(); + server.serverName = "HHI"; + server.company = "Fraunhofer HHI"; + server.basePath = webserver_url; + server.port = 0; + + user = new WorldStorageUser(); + user.userName = "HHI"; + user.company = "Fraunhofer HHI"; + user.UUID = "b4380ebb-eb56-41c2-aeaa-146315a39606"; + + // Some admin stuffs + string res = AdminRequest.PingSync(server); + Console.WriteLine("Sending 'ping', got response: " + res); + + res = AdminRequest.AdminSync(server); + Console.WriteLine("Sending 'admin', got response: " + res); + + res = AdminRequest.VersionSync(server); + Console.WriteLine("Sending 'version', got response: " + res); + + // + // Reloc test + // + //RelocTest(); + } + + ~WorldAnalysis() + { + WebSocketClient_Close(); + } + + + public bool isRunning() + { + return websocketConnected && webSocket.ReadyState == WebSocketSharp.WebSocketState.Open; + } + + public void Start() + { + // + // Get all lists from the World Storage REST server (test) + // + if (Program.isDev) + { + // Get trackables + trackables = TrackableRequest.GetTrackablesSync(server); + Console.WriteLine("Querying Trackables: got list with " + trackables.Count + " items: "); + foreach (var t in trackables) + { + Console.WriteLine($"\tUUID: { t.UUID } Name: { t.Name } (Type: { t.TrackableType })"); + } + + // Get anchors + anchors = WorldAnchorRequest.GetWorldAnchorsSync(server); + Console.WriteLine("Querying World Anchors: got list with " + anchors.Count + " items: "); + foreach (var a in anchors) + { + Console.WriteLine($"\tUUID: { a.UUID } Name: { a.Name }"); + } + + // Get links + links = WorldLinkRequest.GetWorldLinksSync(server); + Console.WriteLine("Querying World Links: got list with " + links.Count + " items: "); + foreach (var l in links) + { + //Console.WriteLine($"\tUUID: { l.UUID } From: { l.UUIDFrom } To: { l.UUIDTo }"); + Console.WriteLine($"\tUUID: { l.UUID }"); + } + } + + // + // Start the WebSockets (World Analysis server) + // + webSocket = new WebSocketSharp.WebSocket(websocket_url); + + Console.WriteLine($"[WS] Try connecting the WA server as { modulename}..."); + + // Define standard callbacks + webSocket.OnOpen += (sender, e) => + { + Console.WriteLine("[WS] Connected"); + websocketConnected = true; + + Console.WriteLine($"[WS] Send registration request to server for {modulename}"); + webSocket.Send($"RegisterModule={modulename}"); + }; + webSocket.OnClose += (sender, e) => + { + Console.WriteLine("[WS] Disconnected"); + websocketConnected = false; + }; + webSocket.OnMessage += (sender, e) => WebSocketClient_OnReceive(e.Data); // main event + webSocket.OnError += (sender, e) => Console.WriteLine("[WS] Websocket error!"); + webSocket.Connect(); + } + + public string ToJson(object o) + { + return JsonConvert.SerializeObject(o, Formatting.Indented); + } + + private void WebSocketClient_Close() + { + if (websocketConnected) + { + webSocket.Send("UnregisterModule=" + modulename); + webSocket.Close(); + webSocket = null; + } + } + + public void WebSocketClient_Send(string msg) + { + Console.WriteLine($"[WS] Send to WA server: {msg}"); + webSocket?.Send(msg); + } + + public void _webSocketClient_SendPose(SubscriptionInfo si) + { + //Console.WriteLine($"[WS] #{sendCnt } Send to WA server: {msg}"); + si.sendCnt++; + Console.WriteLine($"[WS] Send pose #{ si.sendCnt } to WA server (ID: { si.uuidSub })"); + webSocket?.Send("NewPose=" + si.pose.ToJson()); + } + + private void WebSocketClient_SendCapabilities() + { + foreach (var cap in capabilities) + { + string cap_json = ToJson(cap); + WebSocketClient_Send("Capabilities=" + cap_json); + } + } + + public void WebSocketClient_SendPose(SubscriptionInfo info) + { + Guid uuidTarget = info.subscription.Target; + ETSI.ARF.OpenAPI.WorldStorage.Transform3D matrix = null; + + Trackable tr = null; + WorldAnchor an = null; + +#if ALWAYS_CALL_REST_API + try + { + tr = TrackableRequest.GetTrackableSync(server, uuidTarget); + matrix = tr.LocalCRS; + } + catch + { + try + { + an = WorldAnchorRequest.GetWorldAnchorSync(server, uuidTarget); + matrix = an.LocalCRS; + } + catch { } + } +#else + foreach (var item in trackables) + { + if (item.UUID == uuidTarget) + { + tr = item; + matrix = tr.LocalCRS; + break; + } + } + + foreach (var item in anchors) + { + if (item.UUID == uuidTarget) + { + an = item; + matrix = an.LocalCRS; + break; + } + } + +#endif + if (matrix == null) + { + WebSocketClient_Send("Error! Pose cannot be calculated (missing trackable or world-anchor)"); + return; + } + + // + // Calculate/Get the current pose of the uuid + // + Pose pose = new Pose(); + pose.Uuid = uuidTarget; + pose.Mode = info.mode; + pose.SubscriptionUrl = websocket_url; + + MatrixPoseValue pv = new MatrixPoseValue(); + pv.Type = PoseValueType.MATRIX; + pv.Unit = ETSI.ARF.OpenAPI.WorldAnalysis.UnitSystem.M; + + // + // Get the reloc infos ? + // + if (info.trackable == null) + { +#if !SIMULATE_ANALYSIS + List uuids = new List { uuidTarget }; + List modes = new List { Mode_WorldStorage.REQUEST_TO_TRACKABLES }; + + RelocalizationInformations relocInfos = RelocalizationInformationRequest.GetRelocalizationInformationSync(server, uuids, modes, capabilities); + foreach (var i in relocInfos.RelocInfo) + { + if (i.RelocObjects.Count > 0) + { + RelocObjects ro = i.RelocObjects.ToList()[0]; + info.trackable = ro.Trackable; + info.transform3d = ro.Transform3D; + break; + } + } +#else + // workaround - validation/simulation (STF669) + //if (info.trackable == null) + { + foreach (var item in links) + { + if (item.UUIDTo == uuidTarget) + { +#if ALWAYS_CALL_REST_API + try + { + Trackable t = TrackableRequest.GetTrackableSync(server, item.UUIDFrom); + info.trackable = t; + info.transform3d = t.LocalCRS; + } + catch { } +#else + foreach (var t in trackables) + { + if (t.UUID == item.UUIDFrom) + { + info.trackable = t; + info.transform3d = t.LocalCRS; + break; + } + } +#endif + } + + + if (item.UUIDFrom == uuidTarget) + { +#if ALWAYS_CALL_REST_API + try + { + Trackable t = TrackableRequest.GetTrackableSync(server, item.UUIDTo); + info.trackable = t; + info.transform3d = t.LocalCRS; + } + catch { } +#else + foreach (var t in trackables) + { + if (t.UUID == item.UUIDTo) + { + info.trackable = t; + info.transform3d = t.LocalCRS; + break; + } + } +#endif + } + } +#endif + } + } + + if (info.trackable != null) + { + pose.InstructionInfo = "Workaround for STF669 (parent; w/no RelocInfo)"; + + // + // Direct parent request (without calling RelocInfo!) + // + ETSI.ARF.OpenAPI.WorldStorage.Transform3D parentMatrix = info.transform3d; + + Matrix4x4 _parentMatrix = parentMatrix.Matrix(); + Matrix4x4 _matrix = matrix.Matrix(); // target + Matrix4x4 m = _matrix * _parentMatrix; // target * parent + + // todo: Invert? + + // Transpose one matrix to the other + pv.Transform = new ETSI.ARF.OpenAPI.WorldAnalysis.Transform3D() + { + m.M11, m.M12, m.M13, m.M14, + m.M21, m.M22, m.M23, m.M24, + m.M31, m.M32, m.M33, m.M34, + m.M41, m.M42, m.M43, m.M44, + }; + } + else + { + pose.InstructionInfo = "Workaround for STF669 (identity pose)"; + + // + // Return identiy + // + + // Transpose one matrix to the other + pv.Transform = new ETSI.ARF.OpenAPI.WorldAnalysis.Transform3D() + { + matrix[0], matrix[1], matrix[2], matrix[3], + matrix[4], matrix[5], matrix[6], matrix[7], + matrix[8], matrix[9], matrix[10], matrix[11], + matrix[12], matrix[13], matrix[14], matrix[15] + }; + } + +#if SIMULATE_ANALYSIS + // Simulate jitter in position + Random r = new Random(); + pv.Transform[3] = pv.Transform[3] + (float)r.NextDouble() * randomScale; + pv.Transform[7] = pv.Transform[7] + (float)r.NextDouble() * randomScale; + pv.Transform[11] = pv.Transform[11] + (float)r.NextDouble() * randomScale; +#endif + + // Set the new pose + pose.Value = pv; + info.pose = pose; + + //Console.WriteLine($"[WS] Found pose for uuid={ uuidTarget }..."); + + // Send the pose + _webSocketClient_SendPose(info); + } + + // Events + private void WebSocketClient_OnReceive(string serverMessage) + { + if (serverMessage.Contains("You are now registered")) + { + isRegistered = true; + Console.WriteLine($"[WS] {serverMessage }"); + //Console.WriteLine($"[WS] Registration of {modulename} was succesfull."); + + WebSocketClient_SendCapabilities(); + + Console.WriteLine($"[WS] Entering the websockets main loop..."); + } + else if (isRegistered) + { + if (serverMessage == "UnregisterModuleOK") + { + // Stop the loop and disconnect the server + sendPose = false; + } + else if (serverMessage.StartsWith("SubscribeSimulatedPose=")) // simulation for STFT669 workaround / SylR + { + Guid uuidSub = Guid.Parse(serverMessage.Split('=')[1]); + string json_subPose = serverMessage.Split('=')[2]; + string _trackableUUID = serverMessage.Split('=')[3]; // extra field + + SubscriptionInfo si = new SubscriptionInfo() + { + uuidSub = uuidSub, + }; + si.subscription = JsonConvert.DeserializeObject(json_subPose); + si.mode = si.subscription.Mode; + Console.WriteLine($"[WS] New pose subscription (simulation) for UUID={ si.subscription.Target }"); + + // receive also the parent object (trackable) from the client? + si.extra = TrackableRequest.GetTrackableSync(server, Guid.Parse(_trackableUUID)); + Console.WriteLine($"Found trackable (UUID={ _trackableUUID }) for simulation: name = { si.extra.Name }"); + + // Update lists + if (!subscriptions.ContainsKey(si.subscription.Target)) subscriptions.Add(si.subscription.Target, si); + if (subscriptions.Count > 0) sendPose = true; + + lastSubscription = si; + + WebSocketClient_Send("PoseIsNowSubscribed"); + } + else if (serverMessage.StartsWith("SubscribePose=")) + { + Guid uuidSub = Guid.Parse(serverMessage.Split('=')[1]); + string json_subPose = serverMessage.Split('=')[2]; + + SubscriptionInfo si = new SubscriptionInfo() + { + uuidSub = uuidSub, + }; + si.subscription = JsonConvert.DeserializeObject(json_subPose); + si.mode = si.subscription.Mode; + Console.WriteLine($"[WS] New pose subscription for UUDI={ si.subscription.Target }"); + + // Update lists + if (!subscriptions.ContainsKey(si.subscription.Target)) subscriptions.Add(si.subscription.Target, si); + if (subscriptions.Count > 0) sendPose = true; + + WebSocketClient_Send("PoseIsNowSubscribed"); + } + else if (serverMessage.StartsWith("UnsubscribePose=")) + { + Guid uuidSub = Guid.Parse(serverMessage.Split('=')[1]); + + // Update lists + foreach (var si in subscriptions.Values) + { + if (si.uuidSub == uuidSub) + { + // remove + subscriptions.Remove(si.subscription.Target); + } + } + if (subscriptions.Count == 0) sendPose = false; + + WebSocketClient_Send("PoseIsNowUnsubscribed"); + } + else if (serverMessage.StartsWith("ConfigureFramerate=")) + { + // todo: check if the framerate is authorized, otherwise send an error back + int fps = int.Parse(serverMessage.Split('=')[1]); + + // Not implemented + WebSocketClient_Send("Error=Server: Setting framerate is not Implemented!"); + } + // + // Special msg for simulating a global user's position + // + else if (serverMessage.StartsWith("CurrentUserPose=")) + { + string _userPose = serverMessage.Split('=')[1]; + Pose userPose = JsonConvert.DeserializeObject(_userPose); + Console.WriteLine($"New user current position is: { userPose.ToJson() }"); + } + // + // Pose requests + // + else if (serverMessage.StartsWith("GetPose=")) // 2 args + { + Guid uuidTarget = Guid.Parse(serverMessage.Split('=')[1]); + Mode_WorldAnalysis mode = Mode_WorldAnalysis.TRACKABLES_TO_DEVICE; // serverMessage.split(':')[2]; + + SubscriptionSingleRequest ss = new SubscriptionSingleRequest(); + ss.Target = uuidTarget; + SubscriptionInfo si = new SubscriptionInfo() + { + uuidSub = Guid.Empty, // without subscription! + mode = mode + }; + WebSocketClient_SendPose(si); + } + else if (serverMessage == "PoseStop") + { + //SetColor(Color.yellow); + } + else if (serverMessage == "RequestNextPose" && sendPose == true) + { + System.Threading.Thread.Sleep(simulationDelay); + foreach (var si in subscriptions.Values) + { + WebSocketClient_SendPose(si); + } + } + } + } + + private void RelocTest() + { + RelocalizationInformation relocInfo = null; + Guid tr_uuid = new Guid("6a555bf1-fceb-4a8c-a648-191087ad1b21"); + + Guid an_uuid = new Guid("da1284ee-e895-4434-906f-5599b92ab51a"); + List uuids = new List + { + an_uuid + }; + + List modes = new List + { + Mode_WorldStorage.TRACKABLES_TO_REQUEST + }; + + /// Collect relocalization information + relocInfos = RelocalizationInformationRequest.GetRelocalizationInformation(server, uuids, modes, capabilities); + if (relocInfos == null) + { + Console.WriteLine("ETSI ARF GetRelocalizationInformation : request response is null"); + } + relocInfo = relocInfos.RelocInfo.First(); //Only one uuid requested + Console.WriteLine($"Found Reloc: num = { relocInfo.RelocObjects.Count }"); + } + } +} diff --git a/wrapper/c#/WorldAnalysisWrapper/bin/Debug/net5.0/WorldAnalysisWrapper.deps.json b/wrapper/c#/WorldAnalysisWrapper/bin/Debug/net5.0/WorldAnalysisWrapper.deps.json new file mode 100644 index 0000000000000000000000000000000000000000..176fead22151c382da1d5708159460e953e0dca0 --- /dev/null +++ b/wrapper/c#/WorldAnalysisWrapper/bin/Debug/net5.0/WorldAnalysisWrapper.deps.json @@ -0,0 +1,57 @@ +{ + "runtimeTarget": { + "name": ".NETCoreApp,Version=v5.0", + "signature": "" + }, + "compilationOptions": {}, + "targets": { + ".NETCoreApp,Version=v5.0": { + "WorldAnalysisWrapper/1.0.0": { + "dependencies": { + "Newtonsoft.Json": "13.0.3", + "websocket-sharp-latest": "1.0.2" + }, + "runtime": { + "WorldAnalysisWrapper.dll": {} + } + }, + "Newtonsoft.Json/13.0.3": { + "runtime": { + "lib/netstandard2.0/Newtonsoft.Json.dll": { + "assemblyVersion": "13.0.0.0", + "fileVersion": "13.0.3.27908" + } + } + }, + "websocket-sharp-latest/1.0.2": { + "runtime": { + "lib/netstandard2.0/websocket-sharp-latest.dll": { + "assemblyVersion": "1.0.2.0", + "fileVersion": "1.0.2.0" + } + } + } + } + }, + "libraries": { + "WorldAnalysisWrapper/1.0.0": { + "type": "project", + "serviceable": false, + "sha512": "" + }, + "Newtonsoft.Json/13.0.3": { + "type": "package", + "serviceable": true, + "sha512": "sha512-HrC5BXdl00IP9zeV+0Z848QWPAoCr9P3bDEZguI+gkLcBKAOxix/tLEAAHC+UvDNPv4a2d18lOReHMOagPa+zQ==", + "path": "newtonsoft.json/13.0.3", + "hashPath": "newtonsoft.json.13.0.3.nupkg.sha512" + }, + "websocket-sharp-latest/1.0.2": { + "type": "package", + "serviceable": true, + "sha512": "sha512-1dLVMsURAIp9YCc43hW9x3HgSw5hWZU+w3YRTWv7HOopm2N4+noa+rCp1VKTEmmRkpJja8oNYmbrDYFZRi7kCw==", + "path": "websocket-sharp-latest/1.0.2", + "hashPath": "websocket-sharp-latest.1.0.2.nupkg.sha512" + } + } +} \ No newline at end of file diff --git a/wrapper/c#/WorldAnalysisWrapper/bin/Debug/net5.0/WorldAnalysisWrapper.runtimeconfig.dev.json b/wrapper/c#/WorldAnalysisWrapper/bin/Debug/net5.0/WorldAnalysisWrapper.runtimeconfig.dev.json new file mode 100644 index 0000000000000000000000000000000000000000..657b9badc2c7681d0c5cd203ae947543b963265b --- /dev/null +++ b/wrapper/c#/WorldAnalysisWrapper/bin/Debug/net5.0/WorldAnalysisWrapper.runtimeconfig.dev.json @@ -0,0 +1,9 @@ +{ + "runtimeOptions": { + "additionalProbingPaths": [ + "C:\\Users\\renault\\.dotnet\\store\\|arch|\\|tfm|", + "C:\\Users\\renault\\.nuget\\packages", + "C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages" + ] + } +} \ No newline at end of file diff --git a/wrapper/c#/WorldAnalysisWrapper/bin/Debug/net5.0/WorldAnalysisWrapper.runtimeconfig.json b/wrapper/c#/WorldAnalysisWrapper/bin/Debug/net5.0/WorldAnalysisWrapper.runtimeconfig.json new file mode 100644 index 0000000000000000000000000000000000000000..a8e7e82874bf4919e97618aed2ac5a89a5c0faa6 --- /dev/null +++ b/wrapper/c#/WorldAnalysisWrapper/bin/Debug/net5.0/WorldAnalysisWrapper.runtimeconfig.json @@ -0,0 +1,9 @@ +{ + "runtimeOptions": { + "tfm": "net5.0", + "framework": { + "name": "Microsoft.NETCore.App", + "version": "5.0.0" + } + } +} \ No newline at end of file diff --git a/wrapper/c#/WorldAnalysisWrapper/obj/Debug/net5.0/.NETCoreApp,Version=v5.0.AssemblyAttributes.cs b/wrapper/c#/WorldAnalysisWrapper/obj/Debug/net5.0/.NETCoreApp,Version=v5.0.AssemblyAttributes.cs new file mode 100644 index 0000000000000000000000000000000000000000..2f7e5ec5afa156f8313c6a17e8a80a25246858f5 --- /dev/null +++ b/wrapper/c#/WorldAnalysisWrapper/obj/Debug/net5.0/.NETCoreApp,Version=v5.0.AssemblyAttributes.cs @@ -0,0 +1,4 @@ +// +using System; +using System.Reflection; +[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v5.0", FrameworkDisplayName = "")] diff --git a/wrapper/c#/WorldAnalysisWrapper/obj/Debug/net5.0/WorldAnalysisWrapper.AssemblyInfo.cs b/wrapper/c#/WorldAnalysisWrapper/obj/Debug/net5.0/WorldAnalysisWrapper.AssemblyInfo.cs new file mode 100644 index 0000000000000000000000000000000000000000..c3bdbfc0fe1cc6fad08983ecd287b4d9e72c5762 --- /dev/null +++ b/wrapper/c#/WorldAnalysisWrapper/obj/Debug/net5.0/WorldAnalysisWrapper.AssemblyInfo.cs @@ -0,0 +1,23 @@ +//------------------------------------------------------------------------------ +// +// Dieser Code wurde von einem Tool generiert. +// Laufzeitversion:4.0.30319.42000 +// +// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn +// der Code erneut generiert wird. +// +//------------------------------------------------------------------------------ + +using System; +using System.Reflection; + +[assembly: System.Reflection.AssemblyCompanyAttribute("WorldAnalysisWrapper")] +[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] +[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] +[assembly: System.Reflection.AssemblyProductAttribute("WorldAnalysisWrapper")] +[assembly: System.Reflection.AssemblyTitleAttribute("WorldAnalysisWrapper")] +[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] + +// Von der MSBuild WriteCodeFragment-Klasse generiert. + diff --git a/wrapper/c#/WorldAnalysisWrapper/obj/Debug/net5.0/WorldAnalysisWrapper.AssemblyInfoInputs.cache b/wrapper/c#/WorldAnalysisWrapper/obj/Debug/net5.0/WorldAnalysisWrapper.AssemblyInfoInputs.cache new file mode 100644 index 0000000000000000000000000000000000000000..4ee14d33f7e8a2959419671de4a54a91adda7a41 --- /dev/null +++ b/wrapper/c#/WorldAnalysisWrapper/obj/Debug/net5.0/WorldAnalysisWrapper.AssemblyInfoInputs.cache @@ -0,0 +1 @@ +5adaa75f34a2faff0b4c6795b47ec0ed127d4d1e diff --git a/wrapper/c#/WorldAnalysisWrapper/obj/Debug/net5.0/WorldAnalysisWrapper.GeneratedMSBuildEditorConfig.editorconfig b/wrapper/c#/WorldAnalysisWrapper/obj/Debug/net5.0/WorldAnalysisWrapper.GeneratedMSBuildEditorConfig.editorconfig new file mode 100644 index 0000000000000000000000000000000000000000..d7e29835d585d70c36f9ec99b31f5a63a0912174 --- /dev/null +++ b/wrapper/c#/WorldAnalysisWrapper/obj/Debug/net5.0/WorldAnalysisWrapper.GeneratedMSBuildEditorConfig.editorconfig @@ -0,0 +1,8 @@ +is_global = true +build_property.TargetFramework = net5.0 +build_property.TargetPlatformMinVersion = +build_property.UsingMicrosoftNETSdkWeb = +build_property.ProjectTypeGuids = +build_property.PublishSingleFile = +build_property.IncludeAllContentForSelfExtract = +build_property._SupportedPlatformList = Android,iOS,Linux,macOS,Windows diff --git a/wrapper/c#/WorldAnalysisWrapper/obj/Debug/net5.0/WorldAnalysisWrapper.assets.cache b/wrapper/c#/WorldAnalysisWrapper/obj/Debug/net5.0/WorldAnalysisWrapper.assets.cache new file mode 100644 index 0000000000000000000000000000000000000000..885baf3f86d322d92d3ee5361c565530318aa6bc Binary files /dev/null and b/wrapper/c#/WorldAnalysisWrapper/obj/Debug/net5.0/WorldAnalysisWrapper.assets.cache differ diff --git a/wrapper/arf specific.txt b/wrapper/c#/WorldAnalysisWrapper/obj/Debug/net5.0/WorldAnalysisWrapper.csproj.CopyComplete similarity index 100% rename from wrapper/arf specific.txt rename to wrapper/c#/WorldAnalysisWrapper/obj/Debug/net5.0/WorldAnalysisWrapper.csproj.CopyComplete diff --git a/wrapper/c#/WorldAnalysisWrapper/obj/Debug/net5.0/WorldAnalysisWrapper.csproj.CoreCompileInputs.cache b/wrapper/c#/WorldAnalysisWrapper/obj/Debug/net5.0/WorldAnalysisWrapper.csproj.CoreCompileInputs.cache new file mode 100644 index 0000000000000000000000000000000000000000..f41a2d43ccfdc907fe56114237f8d5b8ff40d534 --- /dev/null +++ b/wrapper/c#/WorldAnalysisWrapper/obj/Debug/net5.0/WorldAnalysisWrapper.csproj.CoreCompileInputs.cache @@ -0,0 +1 @@ +6575fad8fbac49cf14aae79f887d6a378d3d9299 diff --git a/wrapper/c#/WorldAnalysisWrapper/obj/Debug/net5.0/WorldAnalysisWrapper.csproj.FileListAbsolute.txt b/wrapper/c#/WorldAnalysisWrapper/obj/Debug/net5.0/WorldAnalysisWrapper.csproj.FileListAbsolute.txt new file mode 100644 index 0000000000000000000000000000000000000000..de6ab5590dcc6dc7045537c067bbe5852988c879 --- /dev/null +++ b/wrapper/c#/WorldAnalysisWrapper/obj/Debug/net5.0/WorldAnalysisWrapper.csproj.FileListAbsolute.txt @@ -0,0 +1,38 @@ +D:\Fraunhofer\Projects\ETSI\STF 669\Git-Forge-Labs\world-analysis-hhi-wrapper\wrapper\c#\WorldAnalysisWrapper\bin\Debug\net5.0\WorldAnalysisWrapper.exe +D:\Fraunhofer\Projects\ETSI\STF 669\Git-Forge-Labs\world-analysis-hhi-wrapper\wrapper\c#\WorldAnalysisWrapper\bin\Debug\net5.0\WorldAnalysisWrapper.deps.json +D:\Fraunhofer\Projects\ETSI\STF 669\Git-Forge-Labs\world-analysis-hhi-wrapper\wrapper\c#\WorldAnalysisWrapper\bin\Debug\net5.0\WorldAnalysisWrapper.runtimeconfig.json +D:\Fraunhofer\Projects\ETSI\STF 669\Git-Forge-Labs\world-analysis-hhi-wrapper\wrapper\c#\WorldAnalysisWrapper\bin\Debug\net5.0\WorldAnalysisWrapper.runtimeconfig.dev.json +D:\Fraunhofer\Projects\ETSI\STF 669\Git-Forge-Labs\world-analysis-hhi-wrapper\wrapper\c#\WorldAnalysisWrapper\bin\Debug\net5.0\WorldAnalysisWrapper.dll +D:\Fraunhofer\Projects\ETSI\STF 669\Git-Forge-Labs\world-analysis-hhi-wrapper\wrapper\c#\WorldAnalysisWrapper\bin\Debug\net5.0\ref\WorldAnalysisWrapper.dll +D:\Fraunhofer\Projects\ETSI\STF 669\Git-Forge-Labs\world-analysis-hhi-wrapper\wrapper\c#\WorldAnalysisWrapper\bin\Debug\net5.0\WorldAnalysisWrapper.pdb +D:\Fraunhofer\Projects\ETSI\STF 669\Git-Forge-Labs\world-analysis-hhi-wrapper\wrapper\c#\WorldAnalysisWrapper\obj\Debug\net5.0\WorldAnalysisWrapper.csprojAssemblyReference.cache +D:\Fraunhofer\Projects\ETSI\STF 669\Git-Forge-Labs\world-analysis-hhi-wrapper\wrapper\c#\WorldAnalysisWrapper\obj\Debug\net5.0\WorldAnalysisWrapper.GeneratedMSBuildEditorConfig.editorconfig +D:\Fraunhofer\Projects\ETSI\STF 669\Git-Forge-Labs\world-analysis-hhi-wrapper\wrapper\c#\WorldAnalysisWrapper\obj\Debug\net5.0\WorldAnalysisWrapper.AssemblyInfoInputs.cache +D:\Fraunhofer\Projects\ETSI\STF 669\Git-Forge-Labs\world-analysis-hhi-wrapper\wrapper\c#\WorldAnalysisWrapper\obj\Debug\net5.0\WorldAnalysisWrapper.AssemblyInfo.cs +D:\Fraunhofer\Projects\ETSI\STF 669\Git-Forge-Labs\world-analysis-hhi-wrapper\wrapper\c#\WorldAnalysisWrapper\obj\Debug\net5.0\WorldAnalysisWrapper.csproj.CoreCompileInputs.cache +D:\Fraunhofer\Projects\ETSI\STF 669\Git-Forge-Labs\world-analysis-hhi-wrapper\wrapper\c#\WorldAnalysisWrapper\obj\Debug\net5.0\WorldAnalysisWrapper.dll +D:\Fraunhofer\Projects\ETSI\STF 669\Git-Forge-Labs\world-analysis-hhi-wrapper\wrapper\c#\WorldAnalysisWrapper\obj\Debug\net5.0\ref\WorldAnalysisWrapper.dll +D:\Fraunhofer\Projects\ETSI\STF 669\Git-Forge-Labs\world-analysis-hhi-wrapper\wrapper\c#\WorldAnalysisWrapper\obj\Debug\net5.0\WorldAnalysisWrapper.pdb +D:\Fraunhofer\Projects\ETSI\STF 669\Git-Forge-Labs\world-analysis-hhi-wrapper\wrapper\c#\WorldAnalysisWrapper\obj\Debug\net5.0\WorldAnalysisWrapper.genruntimeconfig.cache +D:\Fraunhofer\Projects\ETSI\STF 669\Git-Forge-Labs\world-analysis-hhi-wrapper\wrapper\c#\WorldAnalysisWrapper\bin\Debug\net5.0\Newtonsoft.Json.dll +D:\Fraunhofer\Projects\ETSI\STF 669\Git-Forge-Labs\world-analysis-hhi-wrapper\wrapper\c#\WorldAnalysisWrapper\obj\Debug\net5.0\WorldAnalysisWrapper.csproj.CopyComplete +D:\Fraunhofer\Projects\ETSI\STF 669\Git-Forge-Labs\world-analysis-hhi-wrapper\wrapper\c#\WorldAnalysisWrapper\bin\Debug\net5.0\websocket-sharp-latest.dll +D:\Fraunhofer\Projects\ETSI\STF 669\Git-Forge-Lab\world-analysis-hhi-wrapper\wrapper\c#\WorldAnalysisWrapper\bin\Debug\net5.0\WorldAnalysisWrapper.exe +D:\Fraunhofer\Projects\ETSI\STF 669\Git-Forge-Lab\world-analysis-hhi-wrapper\wrapper\c#\WorldAnalysisWrapper\bin\Debug\net5.0\WorldAnalysisWrapper.deps.json +D:\Fraunhofer\Projects\ETSI\STF 669\Git-Forge-Lab\world-analysis-hhi-wrapper\wrapper\c#\WorldAnalysisWrapper\bin\Debug\net5.0\WorldAnalysisWrapper.runtimeconfig.json +D:\Fraunhofer\Projects\ETSI\STF 669\Git-Forge-Lab\world-analysis-hhi-wrapper\wrapper\c#\WorldAnalysisWrapper\bin\Debug\net5.0\WorldAnalysisWrapper.runtimeconfig.dev.json +D:\Fraunhofer\Projects\ETSI\STF 669\Git-Forge-Lab\world-analysis-hhi-wrapper\wrapper\c#\WorldAnalysisWrapper\bin\Debug\net5.0\WorldAnalysisWrapper.dll +D:\Fraunhofer\Projects\ETSI\STF 669\Git-Forge-Lab\world-analysis-hhi-wrapper\wrapper\c#\WorldAnalysisWrapper\bin\Debug\net5.0\ref\WorldAnalysisWrapper.dll +D:\Fraunhofer\Projects\ETSI\STF 669\Git-Forge-Lab\world-analysis-hhi-wrapper\wrapper\c#\WorldAnalysisWrapper\bin\Debug\net5.0\WorldAnalysisWrapper.pdb +D:\Fraunhofer\Projects\ETSI\STF 669\Git-Forge-Lab\world-analysis-hhi-wrapper\wrapper\c#\WorldAnalysisWrapper\bin\Debug\net5.0\Newtonsoft.Json.dll +D:\Fraunhofer\Projects\ETSI\STF 669\Git-Forge-Lab\world-analysis-hhi-wrapper\wrapper\c#\WorldAnalysisWrapper\bin\Debug\net5.0\websocket-sharp-latest.dll +D:\Fraunhofer\Projects\ETSI\STF 669\Git-Forge-Lab\world-analysis-hhi-wrapper\wrapper\c#\WorldAnalysisWrapper\obj\Debug\net5.0\WorldAnalysisWrapper.csprojAssemblyReference.cache +D:\Fraunhofer\Projects\ETSI\STF 669\Git-Forge-Lab\world-analysis-hhi-wrapper\wrapper\c#\WorldAnalysisWrapper\obj\Debug\net5.0\WorldAnalysisWrapper.GeneratedMSBuildEditorConfig.editorconfig +D:\Fraunhofer\Projects\ETSI\STF 669\Git-Forge-Lab\world-analysis-hhi-wrapper\wrapper\c#\WorldAnalysisWrapper\obj\Debug\net5.0\WorldAnalysisWrapper.AssemblyInfoInputs.cache +D:\Fraunhofer\Projects\ETSI\STF 669\Git-Forge-Lab\world-analysis-hhi-wrapper\wrapper\c#\WorldAnalysisWrapper\obj\Debug\net5.0\WorldAnalysisWrapper.AssemblyInfo.cs +D:\Fraunhofer\Projects\ETSI\STF 669\Git-Forge-Lab\world-analysis-hhi-wrapper\wrapper\c#\WorldAnalysisWrapper\obj\Debug\net5.0\WorldAnalysisWrapper.csproj.CoreCompileInputs.cache +D:\Fraunhofer\Projects\ETSI\STF 669\Git-Forge-Lab\world-analysis-hhi-wrapper\wrapper\c#\WorldAnalysisWrapper\obj\Debug\net5.0\WorldAnalysisWrapper.csproj.CopyComplete +D:\Fraunhofer\Projects\ETSI\STF 669\Git-Forge-Lab\world-analysis-hhi-wrapper\wrapper\c#\WorldAnalysisWrapper\obj\Debug\net5.0\WorldAnalysisWrapper.dll +D:\Fraunhofer\Projects\ETSI\STF 669\Git-Forge-Lab\world-analysis-hhi-wrapper\wrapper\c#\WorldAnalysisWrapper\obj\Debug\net5.0\ref\WorldAnalysisWrapper.dll +D:\Fraunhofer\Projects\ETSI\STF 669\Git-Forge-Lab\world-analysis-hhi-wrapper\wrapper\c#\WorldAnalysisWrapper\obj\Debug\net5.0\WorldAnalysisWrapper.pdb +D:\Fraunhofer\Projects\ETSI\STF 669\Git-Forge-Lab\world-analysis-hhi-wrapper\wrapper\c#\WorldAnalysisWrapper\obj\Debug\net5.0\WorldAnalysisWrapper.genruntimeconfig.cache diff --git a/wrapper/c#/WorldAnalysisWrapper/obj/Debug/net5.0/WorldAnalysisWrapper.csprojAssemblyReference.cache b/wrapper/c#/WorldAnalysisWrapper/obj/Debug/net5.0/WorldAnalysisWrapper.csprojAssemblyReference.cache new file mode 100644 index 0000000000000000000000000000000000000000..b81d931f0e1e84be4ccf47bc97bace909b14b3ff Binary files /dev/null and b/wrapper/c#/WorldAnalysisWrapper/obj/Debug/net5.0/WorldAnalysisWrapper.csprojAssemblyReference.cache differ diff --git a/wrapper/c#/WorldAnalysisWrapper/obj/Debug/net5.0/WorldAnalysisWrapper.genruntimeconfig.cache b/wrapper/c#/WorldAnalysisWrapper/obj/Debug/net5.0/WorldAnalysisWrapper.genruntimeconfig.cache new file mode 100644 index 0000000000000000000000000000000000000000..90522b4e468553ca27386b7523118d3d8ed5f5b8 --- /dev/null +++ b/wrapper/c#/WorldAnalysisWrapper/obj/Debug/net5.0/WorldAnalysisWrapper.genruntimeconfig.cache @@ -0,0 +1 @@ +4d2d359d4cd2656c78f72ca42547c0b801b99df6 diff --git a/wrapper/c#/WorldAnalysisWrapper/obj/WorldAnalysisWrapper.csproj.nuget.dgspec.json b/wrapper/c#/WorldAnalysisWrapper/obj/WorldAnalysisWrapper.csproj.nuget.dgspec.json new file mode 100644 index 0000000000000000000000000000000000000000..3523053a5c2e5b280a2a535ce1be7e62a02f3433 --- /dev/null +++ b/wrapper/c#/WorldAnalysisWrapper/obj/WorldAnalysisWrapper.csproj.nuget.dgspec.json @@ -0,0 +1,76 @@ +{ + "format": 1, + "restore": { + "D:\\Fraunhofer\\Projects\\ETSI\\STF 669\\Git-Forge-Lab\\world-analysis-hhi-wrapper\\wrapper\\c#\\WorldAnalysisWrapper\\WorldAnalysisWrapper.csproj": {} + }, + "projects": { + "D:\\Fraunhofer\\Projects\\ETSI\\STF 669\\Git-Forge-Lab\\world-analysis-hhi-wrapper\\wrapper\\c#\\WorldAnalysisWrapper\\WorldAnalysisWrapper.csproj": { + "version": "1.0.0", + "restore": { + "projectUniqueName": "D:\\Fraunhofer\\Projects\\ETSI\\STF 669\\Git-Forge-Lab\\world-analysis-hhi-wrapper\\wrapper\\c#\\WorldAnalysisWrapper\\WorldAnalysisWrapper.csproj", + "projectName": "WorldAnalysisWrapper", + "projectPath": "D:\\Fraunhofer\\Projects\\ETSI\\STF 669\\Git-Forge-Lab\\world-analysis-hhi-wrapper\\wrapper\\c#\\WorldAnalysisWrapper\\WorldAnalysisWrapper.csproj", + "packagesPath": "C:\\Users\\renault\\.nuget\\packages\\", + "outputPath": "D:\\Fraunhofer\\Projects\\ETSI\\STF 669\\Git-Forge-Lab\\world-analysis-hhi-wrapper\\wrapper\\c#\\WorldAnalysisWrapper\\obj\\", + "projectStyle": "PackageReference", + "fallbackFolders": [ + "C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages" + ], + "configFilePaths": [ + "C:\\Users\\renault\\AppData\\Roaming\\NuGet\\NuGet.Config", + "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config", + "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" + ], + "originalTargetFrameworks": [ + "net5.0" + ], + "sources": { + "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, + "https://api.nuget.org/v3/index.json": {} + }, + "frameworks": { + "net5.0": { + "targetAlias": "net5.0", + "projectReferences": {} + } + }, + "warningProperties": { + "warnAsError": [ + "NU1605" + ] + } + }, + "frameworks": { + "net5.0": { + "targetAlias": "net5.0", + "dependencies": { + "Newtonsoft.Json": { + "target": "Package", + "version": "[13.0.3, )" + }, + "websocket-sharp-latest": { + "target": "Package", + "version": "[1.0.2, )" + } + }, + "imports": [ + "net461", + "net462", + "net47", + "net471", + "net472", + "net48" + ], + "assetTargetFallback": true, + "warn": true, + "frameworkReferences": { + "Microsoft.NETCore.App": { + "privateAssets": "all" + } + }, + "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\5.0.214\\RuntimeIdentifierGraph.json" + } + } + } + } +} \ No newline at end of file diff --git a/wrapper/c#/WorldAnalysisWrapper/obj/WorldAnalysisWrapper.csproj.nuget.g.props b/wrapper/c#/WorldAnalysisWrapper/obj/WorldAnalysisWrapper.csproj.nuget.g.props new file mode 100644 index 0000000000000000000000000000000000000000..386a5f797145c3b4f38c369c28fd32c18797ff81 --- /dev/null +++ b/wrapper/c#/WorldAnalysisWrapper/obj/WorldAnalysisWrapper.csproj.nuget.g.props @@ -0,0 +1,19 @@ + + + + True + NuGet + $(MSBuildThisFileDirectory)project.assets.json + $(UserProfile)\.nuget\packages\ + C:\Users\renault\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages + PackageReference + 5.9.1 + + + + + + + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) + + \ No newline at end of file diff --git a/wrapper/c#/WorldAnalysisWrapper/obj/WorldAnalysisWrapper.csproj.nuget.g.targets b/wrapper/c#/WorldAnalysisWrapper/obj/WorldAnalysisWrapper.csproj.nuget.g.targets new file mode 100644 index 0000000000000000000000000000000000000000..53cfaa19b16f3769b2bfc33db3b5c0053c16fdba --- /dev/null +++ b/wrapper/c#/WorldAnalysisWrapper/obj/WorldAnalysisWrapper.csproj.nuget.g.targets @@ -0,0 +1,6 @@ + + + + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) + + \ No newline at end of file diff --git a/wrapper/c#/WorldAnalysisWrapper/obj/project.assets.json b/wrapper/c#/WorldAnalysisWrapper/obj/project.assets.json new file mode 100644 index 0000000000000000000000000000000000000000..e4c110f5a525b4585db1f70d75a5ed2640e931b9 --- /dev/null +++ b/wrapper/c#/WorldAnalysisWrapper/obj/project.assets.json @@ -0,0 +1,148 @@ +{ + "version": 3, + "targets": { + "net5.0": { + "Newtonsoft.Json/13.0.3": { + "type": "package", + "compile": { + "lib/netstandard2.0/Newtonsoft.Json.dll": {} + }, + "runtime": { + "lib/netstandard2.0/Newtonsoft.Json.dll": {} + } + }, + "websocket-sharp-latest/1.0.2": { + "type": "package", + "compile": { + "lib/netstandard2.0/websocket-sharp-latest.dll": {} + }, + "runtime": { + "lib/netstandard2.0/websocket-sharp-latest.dll": {} + } + } + } + }, + "libraries": { + "Newtonsoft.Json/13.0.3": { + "sha512": "HrC5BXdl00IP9zeV+0Z848QWPAoCr9P3bDEZguI+gkLcBKAOxix/tLEAAHC+UvDNPv4a2d18lOReHMOagPa+zQ==", + "type": "package", + "path": "newtonsoft.json/13.0.3", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "LICENSE.md", + "README.md", + "lib/net20/Newtonsoft.Json.dll", + "lib/net20/Newtonsoft.Json.xml", + "lib/net35/Newtonsoft.Json.dll", + "lib/net35/Newtonsoft.Json.xml", + "lib/net40/Newtonsoft.Json.dll", + "lib/net40/Newtonsoft.Json.xml", + "lib/net45/Newtonsoft.Json.dll", + "lib/net45/Newtonsoft.Json.xml", + "lib/net6.0/Newtonsoft.Json.dll", + "lib/net6.0/Newtonsoft.Json.xml", + "lib/netstandard1.0/Newtonsoft.Json.dll", + "lib/netstandard1.0/Newtonsoft.Json.xml", + "lib/netstandard1.3/Newtonsoft.Json.dll", + "lib/netstandard1.3/Newtonsoft.Json.xml", + "lib/netstandard2.0/Newtonsoft.Json.dll", + "lib/netstandard2.0/Newtonsoft.Json.xml", + "newtonsoft.json.13.0.3.nupkg.sha512", + "newtonsoft.json.nuspec", + "packageIcon.png" + ] + }, + "websocket-sharp-latest/1.0.2": { + "sha512": "1dLVMsURAIp9YCc43hW9x3HgSw5hWZU+w3YRTWv7HOopm2N4+noa+rCp1VKTEmmRkpJja8oNYmbrDYFZRi7kCw==", + "type": "package", + "path": "websocket-sharp-latest/1.0.2", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "lib/netstandard2.0/websocket-sharp-latest.dll", + "websocket-sharp-latest.1.0.2.nupkg.sha512", + "websocket-sharp-latest.nuspec", + "websocket-sharp_icon.png" + ] + } + }, + "projectFileDependencyGroups": { + "net5.0": [ + "Newtonsoft.Json >= 13.0.3", + "websocket-sharp-latest >= 1.0.2" + ] + }, + "packageFolders": { + "C:\\Users\\renault\\.nuget\\packages\\": {}, + "C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages": {} + }, + "project": { + "version": "1.0.0", + "restore": { + "projectUniqueName": "D:\\Fraunhofer\\Projects\\ETSI\\STF 669\\Git-Forge-Lab\\world-analysis-hhi-wrapper\\wrapper\\c#\\WorldAnalysisWrapper\\WorldAnalysisWrapper.csproj", + "projectName": "WorldAnalysisWrapper", + "projectPath": "D:\\Fraunhofer\\Projects\\ETSI\\STF 669\\Git-Forge-Lab\\world-analysis-hhi-wrapper\\wrapper\\c#\\WorldAnalysisWrapper\\WorldAnalysisWrapper.csproj", + "packagesPath": "C:\\Users\\renault\\.nuget\\packages\\", + "outputPath": "D:\\Fraunhofer\\Projects\\ETSI\\STF 669\\Git-Forge-Lab\\world-analysis-hhi-wrapper\\wrapper\\c#\\WorldAnalysisWrapper\\obj\\", + "projectStyle": "PackageReference", + "fallbackFolders": [ + "C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages" + ], + "configFilePaths": [ + "C:\\Users\\renault\\AppData\\Roaming\\NuGet\\NuGet.Config", + "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config", + "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" + ], + "originalTargetFrameworks": [ + "net5.0" + ], + "sources": { + "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, + "https://api.nuget.org/v3/index.json": {} + }, + "frameworks": { + "net5.0": { + "targetAlias": "net5.0", + "projectReferences": {} + } + }, + "warningProperties": { + "warnAsError": [ + "NU1605" + ] + } + }, + "frameworks": { + "net5.0": { + "targetAlias": "net5.0", + "dependencies": { + "Newtonsoft.Json": { + "target": "Package", + "version": "[13.0.3, )" + }, + "websocket-sharp-latest": { + "target": "Package", + "version": "[1.0.2, )" + } + }, + "imports": [ + "net461", + "net462", + "net47", + "net471", + "net472", + "net48" + ], + "assetTargetFallback": true, + "warn": true, + "frameworkReferences": { + "Microsoft.NETCore.App": { + "privateAssets": "all" + } + }, + "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\5.0.214\\RuntimeIdentifierGraph.json" + } + } + } +} \ No newline at end of file diff --git a/wrapper/c#/WorldAnalysisWrapper/obj/project.nuget.cache b/wrapper/c#/WorldAnalysisWrapper/obj/project.nuget.cache new file mode 100644 index 0000000000000000000000000000000000000000..50cd97835e580622696ce3fbad55f23dc186b1a4 --- /dev/null +++ b/wrapper/c#/WorldAnalysisWrapper/obj/project.nuget.cache @@ -0,0 +1,11 @@ +{ + "version": 2, + "dgSpecHash": "pZkNrM9uJ7+MjfMVevTsfvAv1jKRE6V7dS+EbM//vg/L9qdLB3ot6ELSoxopPc51/FLk7I7qD0fAvKEdfZS8+Q==", + "success": true, + "projectFilePath": "D:\\Fraunhofer\\Projects\\ETSI\\STF 669\\Git-Forge-Lab\\world-analysis-hhi-wrapper\\wrapper\\c#\\WorldAnalysisWrapper\\WorldAnalysisWrapper.csproj", + "expectedPackageFiles": [ + "C:\\Users\\renault\\.nuget\\packages\\newtonsoft.json\\13.0.3\\newtonsoft.json.13.0.3.nupkg.sha512", + "C:\\Users\\renault\\.nuget\\packages\\websocket-sharp-latest\\1.0.2\\websocket-sharp-latest.1.0.2.nupkg.sha512" + ], + "logs": [] +} \ No newline at end of file diff --git a/wrapper/TestWSServer.py b/wrapper/python/TestWSServer.py similarity index 100% rename from wrapper/TestWSServer.py rename to wrapper/python/TestWSServer.py diff --git a/wrapper/WorldAnalysisWrapper.py b/wrapper/python/WorldAnalysisWrapper.py similarity index 70% rename from wrapper/WorldAnalysisWrapper.py rename to wrapper/python/WorldAnalysisWrapper.py index 7454fac2032f95c3d11bbdac7b5bbb8bd314c11f..e32cc7a301982224c7f597558c4b04a18a3e61f4 100644 --- a/wrapper/WorldAnalysisWrapper.py +++ b/wrapper/python/WorldAnalysisWrapper.py @@ -17,7 +17,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # -# Last change: August 2024 +# Author: Fraunhofer HHI, SylR +# Last change: September 2024 # import sys @@ -42,6 +43,7 @@ import ETSI.ARF.OpenAPI.WorldAnalysis from ETSI.ARF.OpenAPI.WorldAnalysis.api import default_api from ETSI.ARF.OpenAPI.WorldAnalysis.api import capabilities_api from ETSI.ARF.OpenAPI.WorldAnalysis.api import pose_api + # Models (classes) from ETSI.ARF.OpenAPI.WorldAnalysis.models.pose import Pose from ETSI.ARF.OpenAPI.WorldAnalysis.models.capability import Capability @@ -56,15 +58,31 @@ from ETSI.ARF.OpenAPI.WorldAnalysis.models.capability import Capability # and then run python script: # python .py +# +# Web server (World Storage) +# + +# for production +webserver_url = "https://etsi.hhi.fraunhofer.de" # public + +# for development +#webserver_url = "http://localhost:61788" +webserver_url = "https://localhost:44301" # secure # See configuration.py for a list of all supported configuration parameters. -configuration = ETSI.ARF.OpenAPI.WorldStorage.Configuration(host="https://etsi.hhi.fraunhofer.de") -#configuration = ETSI.ARF.OpenAPI.WorldStorage.Configuration(host="https://localhost:44301") -#configuration = ETSI.ARF.OpenAPI.WorldStorage.Configuration(host="http://localhost:61788") +configuration = ETSI.ARF.OpenAPI.WorldStorage.Configuration(host=webserver_url) -webs_server = "ws://localhost:61788/ws" -#webs_server = "wss://localhost:44301/ws" -#webs_server = "wss://analysis.etsi.hhi.fraunhofer.de" # final url +# +# WebSocket server (World Analysis) +# + +# for production +websocket_url ="ws://192.168.20.29:8084/ws" # local network +#websocket_url = "wss://analysis.etsi.hhi.fraunhofer.de" # public + +# for development +#websocket_url = "ws://localhost:61788/ws" +websocket_url = "wss://localhost:44301/ws" # secure print() print("ETSI ISG - ARF World Storage") @@ -73,11 +91,9 @@ print("Simple request tests") print("====================") print() print("Using REST World Storage server: " + configuration.host) -print("Using Websockets server: " + webs_server) +print("Using WebSockets server: " + websocket_url) print() -isTime = False -isPose = False running = True success = 0 #websocket = websockets.connect(my_ws_server) @@ -85,16 +101,22 @@ myWebsocket = None serverResponse = "None" modulename = "" msgToSend = "None" +isPose = False +secretToken = "dev" -# certificate -localhost_pem = pathlib.Path(__file__).with_name("localhost.pem") -print(f"Using PEM: {localhost_pem}") -print() - +# +# Handle some certificates +# # See here: https://websockets.readthedocs.io/en/stable/howto/quickstart.html#encrypt-connections -webs_ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) -webs_ssl_context.load_verify_locations(localhost_pem) +#localhost_pem = pathlib.Path(__file__).with_name("localhost.pem") +#webs_ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) +#webs_ssl_context.load_verify_locations(localhost_pem) +#print(f"Using PEM: {localhost_pem}") +#print() +################################################################### +# REST -> World Storage +################################################################### # # Test the REST server availability (World Storage) @@ -114,7 +136,7 @@ def CheckRESTServer(client): print("Sending 'ping', got response: " + api_response) success += 1 except ETSI.ARF.OpenAPI.WorldStorage.ApiException as e: - print("Exception when calling DefaultApi->get_ping: %s\n" % e) + print("[REST] Exception when calling DefaultApi->get_ping: %s\n" % e) try: # Test the server availability. @@ -122,7 +144,7 @@ def CheckRESTServer(client): print("Sending 'version', got response: " + api_response) success += 1 except ETSI.ARF.OpenAPI.WorldStorage.ApiException as e: - print("Exception when calling DefaultApi->get_ping: %s\n" % e) + print("[REST] Exception when calling DefaultApi->get_ping: %s\n" % e) try: # Test the server availability. @@ -130,10 +152,33 @@ def CheckRESTServer(client): print("Sending 'admin', got response: " + api_response) success += 1 except ETSI.ARF.OpenAPI.WorldStorage.ApiException as e: - print("Exception when calling DefaultApi->get_ping: %s\n" % e) + print("[REST] Exception when calling DefaultApi->get_ping: %s\n" % e) return success == 3 +# +# Get the list of trackables +# +def REST_GetTrackables(): + + global firstJob + + # Enter a context with an instance of the API client + with ETSI.ARF.OpenAPI.WorldStorage.ApiClient(configuration) as api_client: + api_instance_t = trackables_api.TrackablesApi(api_client) + + try: + list_response = api_instance_t.get_trackables(token="dev") + print("Querying Trackables: got list with " + str(len(list_response)) + " items:") + for item in list_response: + print(" UUID: " + str(item.uuid) + " Name: " + item.name + " (Type: " + str(item.trackable_type) + ")") + except ETSI.ARF.OpenAPI.WorldStorage.ApiException as e: + print("[REST] Exception when calling TrackablesApi->get_trackables: %s\n" % e) + +################################################################### +# WebSockets -> World Analysis +################################################################### + # # WebSockets helpers # @@ -160,13 +205,14 @@ def _OnReceiveText(msg): async def WS_ConnectAndLoop(): global modulename global msgToSend, serverResponse - global running, isTime + global running, isTime, isPose try: ###ws = websockets.WebSocket(sslopt={"cert_reqs": ssl.CERT_NONE}) - #with connect(uri=webs_server, ssl_context=my_ssl_context) as websocket: + #with connect(uri=websocket + #_server, ssl_context=my_ssl_context) as websocket: - async with websockets.connect(uri=webs_server) as websocket: + async with websockets.connect(uri=websocket_url) as websocket: #myWebsocket = websocket @@ -199,7 +245,7 @@ async def WS_ConnectAndLoop(): cap1.latency = 0.5 cap1.accuracy = 0.8 cap_json = cap1.to_json() - await WS_send(websocket, "Capabilities of:" + modulename + " Data=" + cap_json, isResponse=False) + await WS_send(websocket, "Capabilities=" + cap_json, isResponse=False) elif modulename == "HHI-MeshDetection": @@ -215,7 +261,7 @@ async def WS_ConnectAndLoop(): cap1.latency = 0.5 cap1.accuracy = 0.9 cap_json = cap1.to_json() - await WS_send(websocket, "Capabilities of:" + modulename + " Data=" + cap_json, isResponse=False) + await WS_send(websocket, "Capabilities=" + cap_json, isResponse=False) # Capability #2 cap2 = Capability() @@ -225,10 +271,9 @@ async def WS_ConnectAndLoop(): cap2.latency = 0.05 cap2.accuracy = 1 cap_json = cap2.to_json() - await WS_send(websocket, "Capabilities of:" + modulename + " Data=" + cap_json, isResponse=False) + await WS_send(websocket, "Capabilities=" + cap_json, isResponse=False) - #msgToSend = "Idle" - msgToSend = "TimeStart" # test + msgToSend = "Idle" #msgToSend = "PoseStart" # @@ -244,31 +289,14 @@ async def WS_ConnectAndLoop(): # Wait for a message serverMessage = await WS_receive(websocket) - # Stop the loop and disconnect the server + # + # Management + # if serverMessage == "SessionStop": + # Stop the loop and disconnect the server isPose = False running = False - elif serverMessage.startswith("Time="): - isTime = True - datetime = serverMessage.split('=') - print(f"New server time is: { datetime[1] }") - - elif serverMessage.startswith("TimeStop"): - isTime = False - - elif serverMessage.startswith("ConfigureFramerate:"): - json = serverMessage.split(':')[1] - - elif serverMessage.startswith("GetPose:"): - uuid2 = serverMessage.split(':')[1] - mode = serverMessage.split(':')[2] - - # Send the pose - p = Pose() - msgToSend = "PoseNew:" + p.to_json() - print(f"Send pose for: uuid={ uuid2 }") - elif serverMessage.startswith("SubscribePose:"): uuid = serverMessage.split(':')[1] msgToSend = "PoseIsRegistered" @@ -278,20 +306,29 @@ async def WS_ConnectAndLoop(): uuid = serverMessage.split(':')[1] isPose = False - elif isPose == True and serverMessage == "RequestNextPose": - time.sleep(1) + elif serverMessage.startswith("ConfigureFramerate:"): + fps = serverMessage.split(':')[1] + + # + # Special msg for simulating a global user's position + # + elif serverMessage.startswith("CurrentUserPose="): + userPose = serverMessage.split('=')[1] + print(f"New user current position is: {userPose }") + + # + # Pose requests + # + elif serverMessage.startswith("GetPose:"): # 2 args + uuid2 = serverMessage.split(':')[1] + mode = serverMessage.split(':')[2] - # Send the pose - p = Pose() - msgToSend = "PoseNew:" + p.to_json() - print(f"Send pose for: uuid={ uuid }") + WS_SendPose(uuid2) - elif isTime: - serverResponse = await WS_receive(websocket) - if serverResponse == "TimeStop": - isTime = False - msgToSend = "Idle" + elif isPose == True and serverMessage == "RequestNextPose": + time.sleep(1) + WS_SendPose(uuid) except websockets.exceptions.ConnectionClosed as e: print(f"[WS] Connection closed with error: {e}") @@ -299,6 +336,17 @@ async def WS_ConnectAndLoop(): except Exception as e: print(f"[WS] An error occurred: {e}") + +def WS_SendPose(uuid): + # Send the pose + p = Pose() + + # Get the reloc infos? + + msgToSend = "NewPose:" + p.to_json() + print(f"Send pose for: uuid={ uuid }") + + #async def main(): def main(): global modulename @@ -318,6 +366,8 @@ def main(): if isServerOk == True: print ("[REST] Connection to WS was succesfull.") + REST_GetTrackables() + # # Use this (websockets lib) # diff --git a/wrapper/python/arf specific.txt b/wrapper/python/arf specific.txt new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/wrapper/localhost.pem b/wrapper/python/localhost.pem similarity index 100% rename from wrapper/localhost.pem rename to wrapper/python/localhost.pem diff --git a/wrapper/python/openapitools.json b/wrapper/python/openapitools.json new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391