Develop #10
@@ -7,6 +7,14 @@
|
||||
<ApplicationIcon>Images\Logo\icon1.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="Images\CoolBackground.jpg" />
|
||||
<None Remove="Images\Icons\CheckMark.png" />
|
||||
|
||||
@@ -164,10 +164,10 @@ namespace ClientApp.Utils
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (DataParser.isRawData(messageBytes))
|
||||
/*else if (DataParser.isRawData(messageBytes))
|
||||
{
|
||||
Console.WriteLine($"Received data: {BitConverter.ToString(payloadbytes)}");
|
||||
}
|
||||
}*/
|
||||
|
||||
totalBufferReceived -= expectedMessageLength;
|
||||
expectedMessageLength = BitConverter.ToInt32(totalBuffer, 0);
|
||||
@@ -211,7 +211,7 @@ namespace ClientApp.Utils
|
||||
{
|
||||
throw new ArgumentNullException("no bytes");
|
||||
}
|
||||
byte[] message = DataParser.GetRawDataMessage(bytes);
|
||||
byte[] message = DataParser.GetRawBPMDataMessageServer(bytes);
|
||||
|
||||
if (engineConnection.Connected && engineConnection.FollowingRoute)
|
||||
{
|
||||
@@ -238,7 +238,7 @@ namespace ClientApp.Utils
|
||||
{
|
||||
throw new ArgumentNullException("no bytes");
|
||||
}
|
||||
byte[] message = DataParser.GetRawDataMessage(bytes);
|
||||
byte[] message = DataParser.GetRawBikeDataMessageServer(bytes);
|
||||
bool canSendToEngine = engineConnection.Connected && engineConnection.FollowingRoute;
|
||||
switch (bytes[0])
|
||||
{
|
||||
|
||||
@@ -19,11 +19,11 @@ namespace DoctorApp.ViewModels
|
||||
|
||||
public string Status { get; set; }
|
||||
|
||||
public int Speed { get; set; }
|
||||
public double Speed { get; set; }
|
||||
|
||||
public int BPM { get; set; }
|
||||
|
||||
public int Resistance { get; set; }
|
||||
public float Resistance { get; set; }
|
||||
public int Acc_Power { get; set; }
|
||||
|
||||
public int Curr_Power { get; set; }
|
||||
@@ -71,7 +71,8 @@ namespace DoctorApp.ViewModels
|
||||
|
||||
SetResistance = new RelayCommand<object>((parameter) =>
|
||||
{
|
||||
client.sendMessage(DataParser.getSetResistanceJson(Username, float.Parse(((TextBox)parameter).Text)));
|
||||
client.sendMessage(DataParser.getSetResistanceJson(Username, float.Parse(((TextBox)parameter).Text)));
|
||||
this.Resistance = float.Parse(((TextBox)parameter).Text);
|
||||
});
|
||||
|
||||
}
|
||||
@@ -80,12 +81,31 @@ namespace DoctorApp.ViewModels
|
||||
{
|
||||
//TODO
|
||||
//Parsen van de data you fuck
|
||||
this.BPM = bytes[1];
|
||||
}
|
||||
|
||||
public void BikeData(byte[] bytes)
|
||||
{
|
||||
//TODO
|
||||
//Parsen van de data you fuck
|
||||
switch (bytes[0])
|
||||
{
|
||||
case 0x10:
|
||||
if (bytes[1] != 25)
|
||||
{
|
||||
throw new Exception();
|
||||
}
|
||||
this.Distance = bytes[3];
|
||||
this.Speed = (bytes[4] | (bytes[5] << 8)) * 0.01;
|
||||
break;
|
||||
case 0x19:
|
||||
this.Acc_Power = bytes[3] | (bytes[4] << 8);
|
||||
this.Curr_Power = (bytes[5]) | (bytes[6] & 0b00001111) << 8;
|
||||
break;
|
||||
default:
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace DoctorApp.ViewModels
|
||||
|
||||
public void TransferDataToClientBike(byte[] bytes)
|
||||
{
|
||||
string username = DataParser.getNameFromBytes(bytes);
|
||||
string username = DataParser.getNameFromBytesBike(bytes);
|
||||
foreach(ClientInfoViewModel item in Tabs)
|
||||
{
|
||||
if(item.Username == username)
|
||||
@@ -67,7 +67,7 @@ namespace DoctorApp.ViewModels
|
||||
|
||||
public void TransferDataToClientBPM(byte[] bytes)
|
||||
{
|
||||
string username = DataParser.getNameFromBytes(bytes);
|
||||
string username = DataParser.getNameFromBytesBPM(bytes);
|
||||
foreach (ClientInfoViewModel item in Tabs)
|
||||
{
|
||||
if (item.Username == username)
|
||||
|
||||
@@ -54,6 +54,8 @@ namespace Util
|
||||
return Encoding.ASCII.GetBytes(JsonConvert.SerializeObject(json));
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static byte[] LoginAsDoctor(string mUsername, string mPassword)
|
||||
{
|
||||
dynamic json = new
|
||||
@@ -81,13 +83,9 @@ namespace Util
|
||||
|
||||
private static string ASCIIBytesToString(byte[] bytes, int offset, int length)
|
||||
{
|
||||
unsafe
|
||||
{
|
||||
fixed (byte* pAscii = bytes)
|
||||
{
|
||||
return new String((sbyte*)pAscii, offset, length);
|
||||
}
|
||||
}
|
||||
byte[] nameArray = new byte[length];
|
||||
Array.Copy(bytes, offset, nameArray, 0, length);
|
||||
return Encoding.UTF8.GetString(nameArray);
|
||||
}
|
||||
|
||||
public static bool GetUsernamePassword(byte[] jsonbytes, out string username, out string password)
|
||||
|
||||
Reference in New Issue
Block a user