This commit is contained in:
fabjuuuh
2020-10-19 11:14:05 +02:00
parent 5751bbed81
commit 783c40d7d3
5 changed files with 42 additions and 16 deletions

View File

@@ -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();
}
}