Develop #10
@@ -52,13 +52,15 @@ namespace DoctorApp.ViewModels
|
||||
public void TransferDataToClientBike(byte[] bytes)
|
||||
{
|
||||
string username = DataParser.getNameFromBytesBike(bytes);
|
||||
foreach(ClientInfoViewModel item in Tabs)
|
||||
foreach (ClientInfoViewModel item in Tabs)
|
||||
{
|
||||
if(item.PatientInfo.Username == username)
|
||||
if (item.PatientInfo.Username == username)
|
||||
{
|
||||
item.BikeData(DataParser.getDataWithoutName(bytes,0,8));
|
||||
item.BikeData(DataParser.getDataWithoutName(bytes, 0, 8));
|
||||
return;
|
||||
}
|
||||
}
|
||||
Debug.WriteLine("[MainViewModel] did not find client (bike) username is " + username);
|
||||
}
|
||||
|
||||
public void TransferDataToClientBPM(byte[] bytes)
|
||||
@@ -68,9 +70,11 @@ namespace DoctorApp.ViewModels
|
||||
{
|
||||
if (item.PatientInfo.Username == username)
|
||||
{
|
||||
item.BikeData(DataParser.getDataWithoutName(bytes, 0,2));
|
||||
item.BPMData(DataParser.getDataWithoutName(bytes, 0, 2));
|
||||
return;
|
||||
}
|
||||
}
|
||||
Debug.WriteLine("[MainViewModel] did not find client (bpm) username is " + username);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<UserControl x:Class="DoctorApp.Views.ClientInfoView"
|
||||
<UserControl x:Class="DoctorApp.Views.ClientInfoView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
@@ -44,7 +44,7 @@
|
||||
</DockPanel>
|
||||
<DockPanel Height="26" LastChildFill="False" HorizontalAlignment="Stretch">
|
||||
<TextBox Name="textBox_Resistance" Text="{Binding Path=PatientInfo.Resistance}" TextWrapping="Wrap" Width="110" DockPanel.Dock="Right" IsReadOnly="true"/>
|
||||
<TextBox Name="textBox_CurrentSpeed" Text="{Binding Path=PatientInfo.Speed}" TextWrapping="Wrap" Width="110" DockPanel.Dock="Left" IsReadOnly="true"/>
|
||||
<TextBox Name="textBox_CurrentSpeed" Text="{Binding Path=PatientInfo.Speed, StringFormat=N2}" TextWrapping="Wrap" Width="110" DockPanel.Dock="Left" IsReadOnly="true"/>
|
||||
<TextBox Name="textBox_CurrentBPM" Text="{Binding Path=PatientInfo.BPM}" TextWrapping="Wrap" Width="110" DockPanel.Dock="Top" Height="26" IsReadOnly="true"/>
|
||||
</DockPanel>
|
||||
<DockPanel Height="26" LastChildFill="False">
|
||||
|
||||
@@ -298,7 +298,6 @@ namespace Util
|
||||
|
||||
private static byte[] GetRawDataDoctor(byte[] payload, string username, byte messageID)
|
||||
{
|
||||
Debug.WriteLine(BitConverter.ToString(Encoding.ASCII.GetBytes(username)));
|
||||
byte[] nameArray = Encoding.ASCII.GetBytes(username);
|
||||
byte[] total = new byte[nameArray.Length + payload.Length];
|
||||
Array.Copy(payload, 0, total, 0, payload.Length);
|
||||
@@ -422,7 +421,6 @@ namespace Util
|
||||
/// <returns>the response of the message, so wether it was successful or not.</returns>
|
||||
public static bool getResistanceFromResponseJson(byte[] json)
|
||||
{
|
||||
Debug.WriteLine("got message " + Encoding.ASCII.GetString(json));
|
||||
return ((dynamic)JsonConvert.DeserializeObject(Encoding.ASCII.GetString(json))).data.worked;
|
||||
}
|
||||
|
||||
|
||||
@@ -129,7 +129,8 @@ namespace Server
|
||||
break;
|
||||
case DataParser.START_SESSION:
|
||||
this.communication.StartSessionUser(DataParser.getUsernameFromJson(payloadbytes));
|
||||
this.timer.Start();
|
||||
if (communication.Doctor != this)
|
||||
this.timer.Start();
|
||||
break;
|
||||
case DataParser.STOP_SESSION:
|
||||
this.communication.StopSessionUser(DataParser.getUsernameFromJson(payloadbytes));
|
||||
@@ -169,7 +170,8 @@ namespace Server
|
||||
Array.Copy(this.BikeDataBuffer, 0, this.BikeDataBuffer, 8, 8);
|
||||
Array.Copy(payloadbytes, 0, this.BikeDataBuffer, 0, 8);
|
||||
}
|
||||
//this.communication.Doctor?.sendMessage(DataParser.GetRawBikeDataDoctor(payloadbytes, this.username));
|
||||
this.communication.Doctor?.sendMessage(DataParser.GetRawBikeDataDoctor(payloadbytes, this.username));
|
||||
|
||||
}
|
||||
else if (DataParser.isRawDataBPMServer(message))
|
||||
{
|
||||
@@ -179,8 +181,8 @@ namespace Server
|
||||
{
|
||||
Array.Copy(payloadbytes, 0, this.BPMDataBuffer, 0, 2);
|
||||
}
|
||||
//this.communication.Doctor?.sendMessage(DataParser.GetRawBPMDataDoctor(payloadbytes, this.username));
|
||||
}
|
||||
this.communication.Doctor?.sendMessage(DataParser.GetRawBPMDataDoctor(payloadbytes, this.username));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -207,7 +209,7 @@ namespace Server
|
||||
Debug.WriteLine("[SERVER CLIENT] excetion while trying to get raw bike data: " + e.Message);
|
||||
}
|
||||
|
||||
Debug.WriteLine("[SERVER CLIENT] about to send " +sb.ToString());
|
||||
Debug.WriteLine("[SERVER CLIENT] about to send " + sb.ToString());
|
||||
communication.Doctor.sendMessage(DataParser.GetFileMessage(File.ReadAllBytes(path)));
|
||||
}
|
||||
|
||||
@@ -316,6 +318,7 @@ namespace Server
|
||||
this.communication.Doctor?.sendMessage(DataParser.GetRawBPMDataDoctor(this.BPMDataBuffer, this.username));
|
||||
}
|
||||
this.timer.Start();
|
||||
Debug.WriteLine("[serverclient] send bike and bpm data timer");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user