Progress with structure to send data
This commit is contained in:
@@ -6,6 +6,14 @@
|
||||
<UseWPF>true</UseWPF>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AsyncAwaitBestPractices.MVVM" Version="4.3.0" />
|
||||
<PackageReference Include="MvvmLightLibsStd10" Version="5.4.1.1" />
|
||||
|
||||
@@ -123,13 +123,14 @@ namespace DoctorApp.Utils
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (DataParser.isRawData(messageBytes))
|
||||
else if (DataParser.isRawDataBikeDoctor(messageBytes))
|
||||
{
|
||||
Console.WriteLine($"Received data: {BitConverter.ToString(payloadbytes)}");
|
||||
MainViewModel.TransferDataToClientBike(payloadbytes);
|
||||
}
|
||||
else if (DataParser.isRawDataBPMDoctor(messageBytes))
|
||||
{
|
||||
MainViewModel.TransferDataToClientBPM(payloadbytes);
|
||||
}
|
||||
|
||||
totalBufferReceived -= expectedMessageLength;
|
||||
expectedMessageLength = BitConverter.ToInt32(totalBuffer, 0);
|
||||
}
|
||||
|
||||
this.stream.BeginRead(this.buffer, 0, this.buffer.Length, new AsyncCallback(OnRead), null);
|
||||
|
||||
@@ -76,6 +76,18 @@ namespace DoctorApp.ViewModels
|
||||
|
||||
}
|
||||
|
||||
public void BPMData(byte [] bytes)
|
||||
{
|
||||
//TODO
|
||||
//Parsen van de data you fuck
|
||||
}
|
||||
|
||||
public void BikeData(byte[] bytes)
|
||||
{
|
||||
//TODO
|
||||
//Parsen van de data you fuck
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Windows.Controls;
|
||||
using Util;
|
||||
@@ -51,6 +52,30 @@ namespace DoctorApp.ViewModels
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void TransferDataToClientBike(byte[] bytes)
|
||||
{
|
||||
string username = DataParser.getNameFromBytes(bytes);
|
||||
foreach(ClientInfoViewModel item in Tabs)
|
||||
{
|
||||
if(item.Username == username)
|
||||
{
|
||||
item.BikeData(bytes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void TransferDataToClientBPM(byte[] bytes)
|
||||
{
|
||||
string username = DataParser.getNameFromBytes(bytes);
|
||||
foreach (ClientInfoViewModel item in Tabs)
|
||||
{
|
||||
if (item.Username == username)
|
||||
{
|
||||
item.BikeData(bytes);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user