diff --git a/Assets/AltTester/Runtime/AltDriver/Communication/BaseDriver.cs b/Assets/AltTester/Runtime/AltDriver/Communication/BaseDriver.cs
new file mode 100644
index 000000000..8b02e8bbe
--- /dev/null
+++ b/Assets/AltTester/Runtime/AltDriver/Communication/BaseDriver.cs
@@ -0,0 +1,72 @@
+/*
+ Copyright(C) 2023 Altom Consulting
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
+
+using System;
+using System.Diagnostics;
+using AltTester.AltTesterUnitySDK.Driver.Logging;
+
+namespace AltTester.AltTesterUnitySDK.Driver.Communication
+{
+ public class BaseDriver
+ {
+ protected static readonly NLog.Logger Logger = DriverLogManager.Instance.GetCurrentClassLogger();
+
+ protected DriverWebSocketClient WsClient = null;
+
+ protected bool isRunning = false;
+
+ public bool IsRunning { get { return this.isRunning; } }
+ public bool IsAlive { get { return this.WsClient != null && this.WsClient.IsAlive; } }
+
+ public event EventHandler OnMessage;
+ public event EventHandler OnMessageData;
+ protected string path;
+
+ public BaseDriver(string path)
+ {
+ this.path = path;
+ }
+
+ public void Close()
+ {
+ Logger.Info(string.Format("Closing connection to AltTester on: '{0}'.", this.WsClient.URI));
+
+ this.isRunning = false;
+ this.WsClient.Close();
+ }
+
+ public void Connect(string host, int port, string appName, int connectTimeout, string platform, string platformVersion, string deviceInstanceId, string appId)
+ {
+ this.isRunning = false;
+ UnityEngine.Debug.Log("Path: " + path);
+ this.WsClient = new DriverWebSocketClient(host, port, path, appName, connectTimeout, platform, platformVersion, deviceInstanceId, appId);
+ this.WsClient.OnMessage += (sender, e) =>
+ {
+ if (e.IsText)
+ {
+ OnMessageData.Invoke(this, e.Data);
+ return;
+ }
+ this.OnMessage.Invoke(this, e.RawData);
+ };
+ this.WsClient.Connect();
+ }
+
+
+
+ }
+}
diff --git a/Assets/AltTester/Runtime/AltDriver/Communication/BaseDriver.cs.meta b/Assets/AltTester/Runtime/AltDriver/Communication/BaseDriver.cs.meta
new file mode 100644
index 000000000..867087ddc
--- /dev/null
+++ b/Assets/AltTester/Runtime/AltDriver/Communication/BaseDriver.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: aa0c3af707b57bb4e9954f886eac3a74
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/AltTester/Runtime/AltDriver/Communication/GetConnectedAppDriver.cs b/Assets/AltTester/Runtime/AltDriver/Communication/GetConnectedAppDriver.cs
new file mode 100644
index 000000000..452950205
--- /dev/null
+++ b/Assets/AltTester/Runtime/AltDriver/Communication/GetConnectedAppDriver.cs
@@ -0,0 +1,32 @@
+/*
+ Copyright(C) 2023 Altom Consulting
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
+
+namespace AltTester.AltTesterUnitySDK.Driver.Communication
+{
+ public class GetConnectedAppDriver : BaseDriver
+ {
+ private new string path = "/altws/connected-app";
+
+ public GetConnectedAppDriver(string path) : base(path)
+ {
+ }
+ public void Send()
+ {
+ WsClient.Send("GetApps");
+ }
+ }
+}
diff --git a/Assets/AltTester/Runtime/AltDriver/Communication/GetConnectedAppDriver.cs.meta b/Assets/AltTester/Runtime/AltDriver/Communication/GetConnectedAppDriver.cs.meta
new file mode 100644
index 000000000..afe152ab5
--- /dev/null
+++ b/Assets/AltTester/Runtime/AltDriver/Communication/GetConnectedAppDriver.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 2f6f70059484361488cd6a8686d1ac37
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/AltTester/Runtime/AltDriver/Communication/LiveUpdateDriver.cs b/Assets/AltTester/Runtime/AltDriver/Communication/LiveUpdateDriver.cs
index ea94e79f6..dd0d87c2d 100644
--- a/Assets/AltTester/Runtime/AltDriver/Communication/LiveUpdateDriver.cs
+++ b/Assets/AltTester/Runtime/AltDriver/Communication/LiveUpdateDriver.cs
@@ -15,68 +15,40 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Threading;
-using AltTester.AltTesterUnitySDK.Driver.Logging;
using Newtonsoft.Json;
namespace AltTester.AltTesterUnitySDK.Driver.Communication
{
- public class LiveUpdateDriver
- {
- private static readonly NLog.Logger logger = DriverLogManager.Instance.GetCurrentClassLogger();
-
- private DriverWebSocketClient wsClient = null;
-
- public event EventHandler OnMessage;
-
- private bool isRunning = false;
- public bool IsRunning { get { return this.isRunning; } }
- public bool IsAlive { get { return this.wsClient != null && this.wsClient.IsAlive; } }
-
- public void Connect(string host, int port, string appName, int connectTimeout, string platform, string platformVersion, string deviceInstanceId, string appId)
- {
- this.isRunning = false;
- this.wsClient = new DriverWebSocketClient(host, port, "/altws/live-update", appName, connectTimeout, platform, platformVersion, deviceInstanceId, appId);
- this.wsClient.OnMessage += (sender, e) =>
- {
- this.OnMessage.Invoke(this, e.RawData);
- };
- this.wsClient.Connect();
- }
-
- public void Close()
+ public class LiveUpdateDriver : BaseDriver
+ {
+ public LiveUpdateDriver(string path) : base(path)
{
- logger.Info(string.Format("Closing connection to AltTester on: '{0}'.", this.wsClient.URI));
-
- this.isRunning = false;
- this.wsClient.Close();
}
-
public void Start()
{
- this.wsClient.Send("Start");
+ this.WsClient.Send("Start");
this.isRunning = true;
}
public void Stop()
{
- this.wsClient.Send("Stop");
+ this.WsClient.Send("Stop");
this.isRunning = false;
}
public void UpdateFrameRate(int frameRate)
{
- this.wsClient.Send(string.Format("FrameRate:{0}", frameRate));
+ this.WsClient.Send(string.Format("FrameRate:{0}", frameRate));
}
public void UpdateQuality(int quality)
{
- this.wsClient.Send(string.Format("Quality:{0}", quality));
+ this.WsClient.Send(string.Format("Quality:{0}", quality));
}
}
}
diff --git a/Assets/AltTester/Runtime/AltDriver/Communication/Utils.cs b/Assets/AltTester/Runtime/AltDriver/Communication/Utils.cs
index 4616e1fc3..48c1291c7 100644
--- a/Assets/AltTester/Runtime/AltDriver/Communication/Utils.cs
+++ b/Assets/AltTester/Runtime/AltDriver/Communication/Utils.cs
@@ -29,14 +29,14 @@ public static Uri CreateURI(string host, int port, string path, string appName,
{
if (!Uri.TryCreate(string.Format("ws://{0}:{1}{2}?appName={3}&platform={4}&platformVersion={5}&deviceInstanceId={6}", host, port, path, Uri.EscapeDataString(appName), Uri.EscapeDataString(platform), Uri.EscapeDataString(platformVersion), Uri.EscapeDataString(deviceInstanceId)), UriKind.Absolute, out uri))
{
- throw new Exception(String.Format("Invalid host or port {0}:{1}", host, port));
+ throw new Exception(String.Format("Invalid host or port {0}:{1}{2}", host, port, path));
}
}
else
{
if (!Uri.TryCreate(string.Format("ws://{0}:{1}{2}?appName={3}&platform={4}&platformVersion={5}&deviceInstanceId={6}&appId={7}", host, port, path, Uri.EscapeDataString(appName), Uri.EscapeDataString(platform), Uri.EscapeDataString(platformVersion), Uri.EscapeDataString(deviceInstanceId), Uri.EscapeDataString(appId)), UriKind.Absolute, out uri))
{
- throw new Exception(String.Format("Invalid host or port {0}:{1}", host, port));
+ throw new Exception(String.Format("Invalid host or port {0}:{1}{2}", host, port, path));
}
}