Skip to content
Snippets Groups Projects
Commit ce716a98 authored by Sylvain Renault's avatar Sylvain Renault
Browse files

Merge branch 'feature/WAClientWithWebsockets' into 'main'

Finalisation of REST and websocket client functions and subscription methodics.

See merge request !2
parents 68788e54 866c2b4a
No related branches found
No related tags found
1 merge request!2Finalisation of REST and websocket client functions and subscription methodics.
Showing
with 620 additions and 0 deletions
//
// 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: August 2024
//
using UnityEditor;
[CustomEditor(typeof(WorldAnalysisInfo))]
public class WorldAnalysisInfoEditor : Editor
{
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
EditorGUILayout.Space();
WorldAnalysisInfo srv = (WorldAnalysisInfo)target;
string state = "";// srv.GetServerState();
EditorGUILayout.LabelField("Server State", state);
string api = "";// srv.GetAPIVersion();
EditorGUILayout.LabelField("OpenAPI Version", api);
}
}
fileFormatVersion: 2
guid: 4b890e537ebae974b862e97bfefa51ad
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
//
// 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: July 2024
//
using System.Collections;
using UnityEngine;
using UnityEditor;
using ETSI.ARF.OpenAPI;
using ETSI.ARF.OpenAPI.WorldAnalysis;
using ETSI.ARF.WorldAnalysis;
using ETSI.ARF.WorldAnalysis.REST;
[CustomEditor(typeof(WorldAnalysisServer))]
public class WorldStorageServerEditor : Editor
{
WorldAnalysisServer server;
private string state = "";
private string version = "";
private string test = "";
private Queue handleResponseQueue = new Queue();
private ResponseObject<string> pendingTest = null;
private ResponseObject<string> pendingState = null;
private ResponseObject<string> pendingVersion = null;
public void OnEnable()
{
server = (WorldAnalysisServer)target;
}
public override void OnInspectorGUI()
{
serializedObject.Update();
DrawDefaultInspector();
EditorGUILayout.Space();
if (GUILayout.Button("Test server"))
{
TestPing();
}
EditorGUILayout.LabelField("Test Response", test);
EditorGUILayout.Space();
if (GUILayout.Button("Query server"))
{
QueryServer();
}
EditorGUILayout.LabelField("Server State", state);
EditorGUILayout.LabelField("OpenAPI Version", version);
if (handleResponseQueue.Count > 0)
{
object o = handleResponseQueue.Dequeue();
if (o.Equals(pendingTest))
{
ResponseObject<string> response = o as ResponseObject<string>;
Debug.Log($"Get '{response.result}' from server");
test = response.result;
pendingTest = null;
EditorUtility.SetDirty(target);
}
else if (o.Equals(pendingState))
{
ResponseObject<string> response = o as ResponseObject<string>;
Debug.Log($"Get '{response.result}' from server");
state = response.result;
pendingState = null;
EditorUtility.SetDirty(target);
}
else if (o.Equals(pendingVersion))
{
ResponseObject<string> response = o as ResponseObject<string>;
Debug.Log($"Get '{response.result}' from server");
version = response.result;
pendingVersion = null;
EditorUtility.SetDirty(target);
}
else
{
Debug.Log("Unsupported response!");
}
}
}
public override bool RequiresConstantRepaint()
{
return handleResponseQueue.Count > 0;
}
void OnSceneGUI()
{
Debug.Log("OnSceneGUI");
}
private void TestPing()
{
test = "";
EditorUtility.SetDirty(target);
if (server == null)
{
Debug.LogError("No server defined!");
return;
}
//string response = AdminRequest.PingSync(server);
//EditorUtility.DisplayDialog("Test Server", $"Get '{response}' from server", "OK");
if (pendingTest != null)
{
pendingTest.Cancel();
}
pendingTest = AdminRequest.PingAsync(server, (response) =>
{
handleResponseQueue.Enqueue(response);
Debug.Log($"Request Time: { response.requestTime.ToLongTimeString() } / Total Time: { response.DeltaTime.TotalMilliseconds }ms\n\n<b>Content:</b>\n{ response.result }");
});
Debug.Log("Starting request @ time: " + pendingTest.requestTime.ToLongTimeString() + "...");
}
private void QueryServer()
{
version = "";
state = "";
if (pendingState != null)
{
pendingState.Cancel();
}
pendingState = AdminRequest.AdminAsync(server, (response) =>
{
handleResponseQueue.Enqueue(response);
});
if (pendingVersion != null)
{
pendingVersion.Cancel();
}
pendingVersion = AdminRequest.VersionAsync(server, (response) =>
{
handleResponseQueue.Enqueue(response);
});
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 9899978f4c750de4b98f81a9c6937a94
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
//
// ARF - Augmented Reality Framework (ETSI ISG ARF)
//
// Copyright 2022 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 2022
//
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using ETSI.ARF.WorldAnalysis;
[CustomEditor(typeof(WorldAnalysisUser))]
public class WorldStorageUserEditor : Editor
{
WorldAnalysisUser user;
public void OnEnable()
{
user = (WorldAnalysisUser)target;
}
public override void OnInspectorGUI()
{
serializedObject.Update();
DrawDefaultInspector();
EditorGUILayout.Space();
if (GUILayout.Button("Generate New Creator UUID"))
{
user.UUID = System.Guid.NewGuid().ToString();
EditorUtility.SetDirty(target);
}
}
}
fileFormatVersion: 2
guid: b0d1b5ae7e5771b4496dfd778bfa031b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 953b8657509a139449794a24f2147730
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 4af05175caa96bb43844e080f1d8701b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
File added
fileFormatVersion: 2
guid: 1494d109bc218c346ab7622ed734ea86
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 9d5dbed810c34cc4db0fe224cda88d0b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: bddbf4bf9ff11da4885638979b82efb2
labels:
- NuGetForUnity
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 1
settings: {}
userData:
assetBundleName:
assetBundleVariant:
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>websocket-sharp-latest</id>
<version>1.0.2</version>
<authors>websocket-sharp-latest</authors>
<license type="expression">MIT</license>
<licenseUrl>https://licenses.nuget.org/MIT</licenseUrl>
<icon>websocket-sharp_icon.png</icon>
<description>Package Description</description>
<releaseNotes>https://github.com/garbles-labs/websocket-sharp/releases</releaseNotes>
<repository type="git" />
<dependencies>
<group targetFramework=".NETStandard2.0" />
</dependencies>
</metadata>
</package>
\ No newline at end of file
fileFormatVersion: 2
guid: a9d61c123a66f5b4a8d236c2972a3609
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Runtime/Packages/websocket-sharp-latest.1.0.2/websocket-sharp_icon.png

911 B

fileFormatVersion: 2
guid: b3235afb951bf0a4f9e21db48a0937f6
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: iPhone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 24a8b3224329f984c9b1737d44f11163
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
//
// 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: August 2024
//
using UnityEngine;
namespace ETSI.ARF.WorldAnalysis
{
[System.Serializable]
[CreateAssetMenu(fileName = "ARFWorldAnalysisServer", menuName = "ARF World Analysis/Create Server", order = 1)]
public class WorldAnalysisServer : ScriptableObject
{
[SerializeField] public string serverName = "myServerName";
[SerializeField] public string company = "";
[SerializeField] public string basePath = "https://";
[SerializeField] public int port = 8080;
[Space(8)]
[SerializeField] public WorldAnalysisUser currentUser = null;
public string URI => port == 0 ? basePath : basePath + ":" + port.ToString();
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 4571d019d0609224aa4a14ed18de30cd
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
//
// 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: August 2024
//
using UnityEngine;
namespace ETSI.ARF.WorldAnalysis
{
[System.Serializable]
[CreateAssetMenu(fileName = "ARFWorldAnalysisUser", menuName = "ARF World Analysis/Create User", order = 1)]
public class WorldAnalysisUser : ScriptableObject
{
[SerializeField] public string userName = "myName";
[SerializeField] public string company = "";
[SerializeField] public string UUID = System.Guid.Empty.ToString();
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment