diff --git a/ClientApp/Utils/Client.cs b/ClientApp/Utils/Client.cs
index ba81623..fa52f8d 100644
--- a/ClientApp/Utils/Client.cs
+++ b/ClientApp/Utils/Client.cs
@@ -43,6 +43,7 @@ namespace ClientApp.Utils
///
private void initEngine()
{
+ Debug.WriteLine("init engine");
engineConnection = EngineConnection.INSTANCE;
engineConnection.OnNoTunnelId = RetryEngineConnection;
engineConnection.OnSuccessFullConnection = engineConnected;
@@ -88,6 +89,7 @@ namespace ClientApp.Utils
/// the result of the async read
private void OnRead(IAsyncResult ar)
{
+ Debug.WriteLine("got message in client app");
if (ar == null || (!ar.IsCompleted) || (!this.stream.CanRead))
return;
@@ -136,7 +138,7 @@ namespace ClientApp.Utils
}
break;
case DataParser.START_SESSION:
- Console.WriteLine("Session started!");
+ Debug.WriteLine("Session started!");
this.sessionRunning = true;
if (engineConnection.Connected && !engineConnection.FollowingRoute) engineConnection.StartRouteFollow();
Debug.WriteLine("start");
@@ -147,25 +149,26 @@ namespace ClientApp.Utils
Debug.WriteLine("stop");
break;
case DataParser.SET_RESISTANCE:
- Console.WriteLine("Set resistance identifier");
+ Debug.WriteLine("Set resistance identifier");
if (this.handler == null)
{
// send that the operation was not successful if the handler is null
- Console.WriteLine("handler is null");
+ Debug.WriteLine("handler is null");
sendMessage(DataParser.getSetResistanceResponseJson(false));
}
else
{
// set the resistance in the vr scene and send that it was successful
float resistance = DataParser.getResistanceFromJson(payloadbytes);
+ Debug.WriteLine("resistance set was " + resistance);
this.handler.setResistance(resistance);
engineConnection.BikeResistance = resistance;
sendMessage(DataParser.getSetResistanceResponseJson(true));
}
break;
case DataParser.MESSAGE:
+ Debug.WriteLine("client has received message from doctor");
engineConnection.DoctorMessage = DataParser.getChatMessageFromJson(payloadbytes);
- Debug.WriteLine("received message from doctor");
break;
case DataParser.NEW_CONNECTION:
this.LoginViewModel.DoctorConnected(DataParser.getUsernameFromJson(payloadbytes));
diff --git a/ClientApp/Utils/EngineConnection.cs b/ClientApp/Utils/EngineConnection.cs
index 1b86ec2..9f5a816 100644
--- a/ClientApp/Utils/EngineConnection.cs
+++ b/ClientApp/Utils/EngineConnection.cs
@@ -225,7 +225,6 @@ namespace ClientApp.Utils
string handLeftId = JSONParser.GetIdSceneInfoChild(message, "LeftHand");
string handRightId = JSONParser.GetIdSceneInfoChild(message, "RightHand");
groundPlaneId = JSONParser.GetIdSceneInfoChild(message, "GroundPlane");
- Write("--- Ground plane id is " + groundPlaneId);
});
// add the route and set the route id
CreateTerrain();
@@ -338,6 +337,7 @@ namespace ClientApp.Utils
private void SetFollowSpeed(float speed)
{
+ Write("starting route follow");
WriteTextMessage(mainCommand.RouteFollow(routeId, bikeId, speed, new float[] { 0, -(float)Math.PI / 2f, 0 }, new float[] { 0, 0, 0 }));
WriteTextMessage(mainCommand.RouteFollow(routeId, cameraId, speed));
}
diff --git a/Hashing/DataParser.cs b/Hashing/DataParser.cs
index a3d7fc4..ff6f5ec 100644
--- a/Hashing/DataParser.cs
+++ b/Hashing/DataParser.cs
@@ -1,6 +1,7 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using System;
+using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
@@ -338,6 +339,7 @@ namespace Util
/// the response of the message, so wether it was successful or not.
public static bool getResistanceFromResponseJson(byte[] json)
{
+ Debug.WriteLine("got message " + Encoding.ASCII.GetString(json));
return ((dynamic)JsonConvert.DeserializeObject(Encoding.ASCII.GetString(json))).data.worked;
}
diff --git a/Server/Client.cs b/Server/Client.cs
index be819e1..d7c6e6c 100644
--- a/Server/Client.cs
+++ b/Server/Client.cs
@@ -122,10 +122,14 @@ namespace Server
//bool worked = DataParser.getResistanceFromResponseJson(payloadbytes);
communication.SendMessageToClient(DataParser.getUsernameFromJson(payloadbytes), message);
//set resistance on doctor GUI
+
break;
case DataParser.DISCONNECT:
communication.Disconnect(this);
break;
+ case DataParser.MESSAGE:
+ communication.SendMessageToClient(DataParser.getUsernameFromJson(payloadbytes), message);
+ break;
default:
Console.WriteLine($"Received json with identifier {identifier}:\n{Encoding.ASCII.GetString(payloadbytes)}");
break;