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 System.Text;
using ProftaakRH; using ProftaakRH;
namespace Client namespace ClientApp.Utils
{ {
public class Client : IDataReceiver public class Client : IDataReceiver
{ {
@@ -79,8 +79,6 @@ namespace Client
this.stream = this.client.GetStream(); this.stream = this.client.GetStream();
tryLogin();
this.stream.BeginRead(this.buffer, 0, this.buffer.Length, new AsyncCallback(OnRead), null); 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.Runtime.InteropServices.WindowsRuntime;
using System.Text; using System.Text;
namespace Client namespace ClientApp.Utils
{ {
public class DataParser public class DataParser
{ {

View File

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

View File

@@ -15,7 +15,7 @@ using System.Windows.Navigation;
using System.Windows.Shapes; using System.Windows.Shapes;
using ClientApp.Utils; using ClientApp.Utils;
using Hardware.Simulators; using Hardware.Simulators;
using Client; using System.Threading;
namespace ClientApp namespace ClientApp
{ {
@@ -25,15 +25,19 @@ namespace ClientApp
public partial class MainWindow : Window public partial class MainWindow : Window
{ {
public MainWindow() public MainWindow()
{ {
InitializeComponent(); System.Diagnostics.Debug.WriteLine("derp1");
DataContext = new MainWindowViewModel();
Client client = new Client(); 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 bLEHandler = new BLEHandler(client);
//bLEHandler.Connect(); //bLEHandler.Connect();
@@ -42,10 +46,18 @@ namespace ClientApp
BikeSimulator bikeSimulator = new BikeSimulator(client); 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); client.setHandler(bikeSimulator);
System.Diagnostics.Debug.WriteLine("derp6");
} }
} }
} }

View File

@@ -9,8 +9,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RH-Engine", "..\RH-Engine\R
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Server", "..\Server\Server.csproj", "{B1AB6F51-A20D-4162-9A7F-B3350B7510FD}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Server", "..\Server\Server.csproj", "{B1AB6F51-A20D-4162-9A7F-B3350B7510FD}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Client", "..\Client\Client.csproj", "{5759DD20-7A4F-4D8D-B986-A70A7818C112}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Message", "..\Message\Message.csproj", "{9ED6832D-B0FB-4460-9BCD-FAA58863B0CE}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Message", "..\Message\Message.csproj", "{9ED6832D-B0FB-4460-9BCD-FAA58863B0CE}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DokterApp", "..\DokterApp\DokterApp.csproj", "{B150F08B-13DA-4D17-BD96-7E89F52727C6}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DokterApp", "..\DokterApp\DokterApp.csproj", "{B150F08B-13DA-4D17-BD96-7E89F52727C6}"
@@ -22,7 +20,6 @@ EndProject
Global Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution GlobalSection(SharedMSBuildProjectFiles) = preSolution
..\Hashing\Hashing.projitems*{013aadba-1d27-4a52-81d8-217697e91039}*SharedItemsImports = 5 ..\Hashing\Hashing.projitems*{013aadba-1d27-4a52-81d8-217697e91039}*SharedItemsImports = 5
..\Hashing\Hashing.projitems*{5759dd20-7a4f-4d8d-b986-a70a7818c112}*SharedItemsImports = 5
..\Hashing\Hashing.projitems*{70277749-d423-4871-b692-2efc5a6ed932}*SharedItemsImports = 13 ..\Hashing\Hashing.projitems*{70277749-d423-4871-b692-2efc5a6ed932}*SharedItemsImports = 13
..\Hashing\Hashing.projitems*{b1ab6f51-a20d-4162-9a7f-b3350b7510fd}*SharedItemsImports = 5 ..\Hashing\Hashing.projitems*{b1ab6f51-a20d-4162-9a7f-b3350b7510fd}*SharedItemsImports = 5
EndGlobalSection EndGlobalSection
@@ -43,10 +40,6 @@ Global
{B1AB6F51-A20D-4162-9A7F-B3350B7510FD}.Debug|Any CPU.Build.0 = Debug|Any CPU {B1AB6F51-A20D-4162-9A7F-B3350B7510FD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B1AB6F51-A20D-4162-9A7F-B3350B7510FD}.Release|Any CPU.ActiveCfg = Release|Any CPU {B1AB6F51-A20D-4162-9A7F-B3350B7510FD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B1AB6F51-A20D-4162-9A7F-B3350B7510FD}.Release|Any CPU.Build.0 = Release|Any CPU {B1AB6F51-A20D-4162-9A7F-B3350B7510FD}.Release|Any CPU.Build.0 = Release|Any CPU
{5759DD20-7A4F-4D8D-B986-A70A7818C112}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5759DD20-7A4F-4D8D-B986-A70A7818C112}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5759DD20-7A4F-4D8D-B986-A70A7818C112}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5759DD20-7A4F-4D8D-B986-A70A7818C112}.Release|Any CPU.Build.0 = Release|Any CPU
{9ED6832D-B0FB-4460-9BCD-FAA58863B0CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9ED6832D-B0FB-4460-9BCD-FAA58863B0CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9ED6832D-B0FB-4460-9BCD-FAA58863B0CE}.Debug|Any CPU.Build.0 = Debug|Any CPU {9ED6832D-B0FB-4460-9BCD-FAA58863B0CE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9ED6832D-B0FB-4460-9BCD-FAA58863B0CE}.Release|Any CPU.ActiveCfg = Release|Any CPU {9ED6832D-B0FB-4460-9BCD-FAA58863B0CE}.Release|Any CPU.ActiveCfg = Release|Any CPU

View File

@@ -1,11 +1,9 @@
using System; using System;
using System.IO; using System.IO;
using System.Linq;
using System.Net.Sockets; using System.Net.Sockets;
using System.Text; using System.Text;
using Client;
using Newtonsoft.Json; using Newtonsoft.Json;
using System.Security.Cryptography; using ClientApp.Utils;
namespace Server namespace Server
{ {

View File

@@ -10,7 +10,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Client\Client.csproj" /> <ProjectReference Include="..\ClientApp\ClientApp.csproj" />
</ItemGroup> </ItemGroup>
<Import Project="..\Hashing\Hashing.projitems" Label="Shared" /> <Import Project="..\Hashing\Hashing.projitems" Label="Shared" />