commit 5b50fe1a4bb3475f4147ef39c143eef46d588b98
Author: Oto Šťáva <oto.stava@gmail.com>
Date:   Sun May 23 18:34:01 2021 +0200

    Re #8906 - Client refactor + doc comments (2)

diff --git a/deltarobot-vr/Assets/DeltaRobotVr/Client.cs b/deltarobot-vr/Assets/DeltaRobotVr/Client.cs
index fc99fad..cfb7e4a 100644
--- a/deltarobot-vr/Assets/DeltaRobotVr/Client.cs
+++ b/deltarobot-vr/Assets/DeltaRobotVr/Client.cs
@@ -8,6 +8,10 @@ using UnityEngine;
 
 namespace DeltaRobotVr
 {
+    
+    /// <summary>
+    /// Singleton class responsible for communication with the Deltarobot server.
+    /// </summary>
     public sealed class Client
     {
         // singleton instance
@@ -63,7 +67,7 @@ namespace DeltaRobotVr
         private long _curveCounter = 0;
 
         private volatile bool _isConnected;
-        private volatile string _eotMsg = string.Empty;
+        private volatile string _eotReason = string.Empty;
 
         private readonly object _reconnectTimeLock = new object();
         private DateTime _reconnectTime = DateTime.Now;
@@ -76,6 +80,9 @@ namespace DeltaRobotVr
         {
         }
 
+        /// <summary>
+        /// Starts the client thread and connects to the server.
+        /// </summary>
         public void Start()
         {
             IsRunning = true;
@@ -83,6 +90,9 @@ namespace DeltaRobotVr
             _thread.Start();
         }
 
+        /// <summary>
+        /// Gracefully stops the client thread. Blocks until the thread actually stops.
+        /// </summary>
         public void Stop()
         {
             IsRunning = false;
@@ -93,18 +103,27 @@ namespace DeltaRobotVr
             }
         }
 
-        public string EotMsg
+        /// <summary>
+        /// Contains a reason received in an end-of-transmission message.
+        /// </summary>
+        public string EotReason
         {
-            get => _eotMsg;
-            private set => _eotMsg = value;
+            get => _eotReason;
+            private set => _eotReason = value;
         }
 
+        /// <summary>
+        /// Whether the client is currently maintaining an active connection to the server.
+        /// </summary>
         public bool IsConnected
         {
             get => _isConnected;
             private set => _isConnected = value;
         }
 
+        /// <summary>
+        /// Current position of the actuator (in server's world space).
+        /// </summary>
         public Single3 ActuatorPosition
         {
             get
@@ -123,7 +142,10 @@ namespace DeltaRobotVr
             } 
         }
 
-        public Single3 CurrentDirectionVector
+        /// <summary>
+        /// The actual direction the actuator is currently moving in.
+        /// </summary>
+        public Single3 ActualDirectionVector
         {
             get
             {
@@ -141,7 +163,10 @@ namespace DeltaRobotVr
             }
         }
 
-        public Single3 DesiredDirectionVector
+        /// <summary>
+        /// The target direction the actuator should be moving in so that it draws the curve.
+        /// </summary>
+        public Single3 TargetDirectionVector
         {
             get
             {
@@ -159,6 +184,9 @@ namespace DeltaRobotVr
             }
         }
 
+        /// <summary>
+        /// The current exercise curve.
+        /// </summary>
         public Single3[] Curve
         {
             get
@@ -177,6 +205,10 @@ namespace DeltaRobotVr
             }
         }
 
+        /// <summary>
+        /// A counter used to determine whether the curve has changed. The curve remains the same while the counter is
+        /// the same.
+        /// </summary>
         public long CurveCounter
         {
             get
@@ -195,6 +227,9 @@ namespace DeltaRobotVr
             }
         }
 
+        /// <summary>
+        /// Whether the client thread should keep on reading data from the server.
+        /// </summary>
         public bool IsRunning
         {
             get {
@@ -212,6 +247,9 @@ namespace DeltaRobotVr
             }
         }
 
+        /// <summary>
+        /// The time at which the client will attempt to reconnect to the server again.
+        /// </summary>
         public DateTime ReconnectTime
         {
             get
@@ -230,6 +268,9 @@ namespace DeltaRobotVr
             }
         }
 
+        /// <summary>
+        /// The client thread function.
+        /// </summary>
         private void ThreadProcedure()
         {
             while (IsRunning)
@@ -294,13 +335,13 @@ namespace DeltaRobotVr
                     ProcessEot(reader);
                     break;
                 case CurrentActuatorPositionId:
-                    ProcessCurrentActuatorPosition(reader);
+                    ProcessActuatorPosition(reader);
                     break;
                 case CurrentDirectionVectorId:
-                    ProcessCurrentDirectionVector(reader);
+                    ProcessActualDirectionVector(reader);
                     break;
                 case DesiredDirectionVectorId:
-                    ProcessDesiredDirectionVector(reader);
+                    ProcessTargetDirectionVector(reader);
                     break;
                 case CurveId:
                     ProcessCurve(reader);
@@ -373,7 +414,7 @@ namespace DeltaRobotVr
             reader.ReadBytes((int) numberOfBytes);
         }
 
-        private void ProcessCurrentActuatorPosition(BinaryReader reader)
+        private void ProcessActuatorPosition(BinaryReader reader)
         {
             var x = reader.ReadSingle();
             var y = reader.ReadSingle();
@@ -383,24 +424,24 @@ namespace DeltaRobotVr
             ActuatorPosition = new Single3(x, y, z);
         }
 
-        private void ProcessCurrentDirectionVector(BinaryReader reader)
+        private void ProcessActualDirectionVector(BinaryReader reader)
         {
             var x = reader.ReadSingle();
             var y = reader.ReadSingle();
             var z = reader.ReadSingle();
             reader.ReadSingle(); // skip unused
 
-            CurrentDirectionVector = new Single3(x, y, z);
+            ActualDirectionVector = new Single3(x, y, z);
         }
 
-        private void ProcessDesiredDirectionVector(BinaryReader reader)
+        private void ProcessTargetDirectionVector(BinaryReader reader)
         {
             var x = reader.ReadSingle();
             var y = reader.ReadSingle();
             var z = reader.ReadSingle();
             reader.ReadSingle(); // skip unused
 
-            DesiredDirectionVector = new Single3(x, y, z);
+            TargetDirectionVector = new Single3(x, y, z);
         }
 
         private void ProcessCurve(BinaryReader reader)
@@ -428,7 +469,7 @@ namespace DeltaRobotVr
         {
             UInt32 numberOfBytes = reader.ReadUInt32();
             Byte[] buffer = reader.ReadBytes((int) numberOfBytes);
-            EotMsg = Encoding.ASCII.GetString(buffer);
+            EotReason = Encoding.ASCII.GetString(buffer);
             IsConnected = false;
         }
 
diff --git a/deltarobot-vr/Assets/DeltaRobotVr/Components/ActualDirectionArrow.cs b/deltarobot-vr/Assets/DeltaRobotVr/Components/ActualDirectionArrow.cs
index aaac57f..2577d21 100644
--- a/deltarobot-vr/Assets/DeltaRobotVr/Components/ActualDirectionArrow.cs
+++ b/deltarobot-vr/Assets/DeltaRobotVr/Components/ActualDirectionArrow.cs
@@ -6,6 +6,6 @@ namespace DeltaRobotVr.Components
     /// </summary>
     public class ActualDirectionArrow : AbstractArrow
     {
-        protected override Single3 GetVector() => Client.Instance.CurrentDirectionVector;
+        protected override Single3 GetVector() => Client.Instance.ActualDirectionVector;
     }
 }
diff --git a/deltarobot-vr/Assets/DeltaRobotVr/Components/StatusDisplay.cs b/deltarobot-vr/Assets/DeltaRobotVr/Components/StatusDisplay.cs
index 8086c69..89afec9 100644
--- a/deltarobot-vr/Assets/DeltaRobotVr/Components/StatusDisplay.cs
+++ b/deltarobot-vr/Assets/DeltaRobotVr/Components/StatusDisplay.cs
@@ -25,13 +25,13 @@ public class StatusDisplay : MonoBehaviour
         }
         else
         {
-            if (Client.Instance.EotMsg.Length == 0)
+            if (Client.Instance.EotReason.Length == 0)
             {
                 _textComp.text = STATUS + CONNECTING;
             }
             else
             {
-                _textComp.text = STATUS + CONNECTING + "\n" + Client.Instance.EotMsg;
+                _textComp.text = STATUS + CONNECTING + "\n" + Client.Instance.EotReason;
             }
         }
     }
diff --git a/deltarobot-vr/Assets/DeltaRobotVr/Components/TargetDirectionArrow.cs b/deltarobot-vr/Assets/DeltaRobotVr/Components/TargetDirectionArrow.cs
index c5fa6e4..72778c8 100644
--- a/deltarobot-vr/Assets/DeltaRobotVr/Components/TargetDirectionArrow.cs
+++ b/deltarobot-vr/Assets/DeltaRobotVr/Components/TargetDirectionArrow.cs
@@ -6,6 +6,6 @@ namespace DeltaRobotVr.Components
     /// </summary>
     public class TargetDirectionArrow : AbstractArrow
     {
-        protected override Single3 GetVector() => Client.Instance.DesiredDirectionVector;
+        protected override Single3 GetVector() => Client.Instance.TargetDirectionVector;
     }
 }
diff --git a/deltarobot-vr/Assets/DeltaRobotVr/Single3.cs b/deltarobot-vr/Assets/DeltaRobotVr/Single3.cs
index 3201246..61b1b0c 100644
--- a/deltarobot-vr/Assets/DeltaRobotVr/Single3.cs
+++ b/deltarobot-vr/Assets/DeltaRobotVr/Single3.cs
@@ -1,5 +1,9 @@
 namespace DeltaRobotVr
 {
+    
+    /// <summary>
+    /// A simple 3D float vector.
+    /// </summary>
     public readonly struct Single3
     {
         public float X { get; }
diff --git a/deltarobot-vr/Assets/DeltaRobotVr/Single3Utils.cs b/deltarobot-vr/Assets/DeltaRobotVr/Single3Utils.cs
index 28b6175..38c452c 100644
--- a/deltarobot-vr/Assets/DeltaRobotVr/Single3Utils.cs
+++ b/deltarobot-vr/Assets/DeltaRobotVr/Single3Utils.cs
@@ -2,6 +2,10 @@ using UnityEngine;
 
 namespace DeltaRobotVr
 {
+    
+    /// <summary>
+    /// Utilities for the <c>Single3</c> struct.
+    /// </summary>
     public class Single3Utils
     {
         public const float PositionScale = 0.001f;
