This commit is contained in:
shinichi
2020-10-07 18:34:04 +02:00
parent 46083b3912
commit 7bf5bdb1ce
8 changed files with 33 additions and 30 deletions

View File

@@ -4,7 +4,7 @@ using System.Net.Sockets;
using System.Text;
using ProftaakRH;
namespace Client
namespace ClientApp.Utils
{
public class Client : IDataReceiver
{
@@ -79,8 +79,6 @@ namespace Client
this.stream = this.client.GetStream();
tryLogin();
this.stream.BeginRead(this.buffer, 0, this.buffer.Length, new AsyncCallback(OnRead), null);
}

View File

@@ -6,7 +6,7 @@ using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Text;
namespace Client
namespace ClientApp.Utils
{
public class DataParser
{

View File

@@ -4,7 +4,7 @@ using System.Text;
using RH_Engine;
using System.Net.Sockets;
namespace Client
namespace ClientApp.Utils
{
public delegate void HandleSerial(string message);
public delegate void HandleNoTunnelId();
@@ -77,7 +77,7 @@ namespace Client
}
}
/// <summary>
/// connects to the vr engine and initalizes the serverResponseReader
@@ -109,7 +109,7 @@ namespace Client
public void CreateConnection()
{
WriteTextMessage( "{\r\n\"id\" : \"session/list\",\r\n\"serial\" : \"list\"\r\n}");
WriteTextMessage("{\r\n\"id\" : \"session/list\",\r\n\"serial\" : \"list\"\r\n}");
// wait until we have got a sessionId
while (sessionId == string.Empty) { }
@@ -145,7 +145,8 @@ namespace Client
Connected = false;
FollowingRoute = false;
return;
} else
}
else
{
Write("got tunnel id! " + tunnelId);
Connected = true;
@@ -270,7 +271,8 @@ namespace Client
if (serialResponses.ContainsKey(serial))
{
serialResponses[serial] = action;
} else
}
else
{
serialResponses.Add(serial, action);
}
@@ -300,11 +302,11 @@ namespace Client
public void Stop()
{
serverResponseReader.Stop();
}
public void Write(string msg)
{
Console.WriteLine( "[ENGINECONNECT] " + msg);
Console.WriteLine("[ENGINECONNECT] " + msg);
}
}

View File

@@ -5,7 +5,7 @@ using RH_Engine;
using System.Security.Cryptography;
using System.Text;
namespace Client
namespace ClientApp.Utils
{
class Program
{

View File

@@ -15,7 +15,7 @@ using System.Windows.Navigation;
using System.Windows.Shapes;
using ClientApp.Utils;
using Hardware.Simulators;
using Client;
using System.Threading;
namespace ClientApp
{
@@ -25,15 +25,19 @@ namespace ClientApp
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
DataContext = new MainWindowViewModel();
System.Diagnostics.Debug.WriteLine("derp1");
Client client = new Client();
while (!client.IsConnected())
{
System.Diagnostics.Debug.WriteLine("derp2");
InitializeComponent();
DataContext = new MainWindowViewModel();
System.Diagnostics.Debug.WriteLine("derp3");
}
//BLEHandler bLEHandler = new BLEHandler(client);
//bLEHandler.Connect();
@@ -42,10 +46,18 @@ namespace ClientApp
BikeSimulator bikeSimulator = new BikeSimulator(client);
System.Diagnostics.Debug.WriteLine("derp4");
Thread newThread = new Thread(new ThreadStart(bikeSimulator.StartSimulation));
newThread.Start();
//bikeSimulator.StartSimulation();
System.Diagnostics.Debug.WriteLine("derp5");
bikeSimulator.StartSimulation();
client.setHandler(bikeSimulator);
System.Diagnostics.Debug.WriteLine("derp6");
}
}
}