diff --git a/ErgometerApplication/.vs/ErgometerApplication/v14/.suo b/ErgometerApplication/.vs/ErgometerApplication/v14/.suo index 104d765..8b06f94 100644 Binary files a/ErgometerApplication/.vs/ErgometerApplication/v14/.suo and b/ErgometerApplication/.vs/ErgometerApplication/v14/.suo differ diff --git a/ErgometerApplication/ErgometerApplication/Comport.cs b/ErgometerApplication/ErgometerApplication/Comport.cs deleted file mode 100644 index 57ede15..0000000 --- a/ErgometerApplication/ErgometerApplication/Comport.cs +++ /dev/null @@ -1,65 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO.Ports; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace ErgometerApplication -{ - class ComPort - { - private SerialPort comPort; - - public ComPort() - { - comPort = null; - } - - public Boolean Connect(string port) - { - comPort = new SerialPort(); - comPort.PortName = port; - comPort.DataBits = 8; - comPort.Parity = Parity.None; - comPort.StopBits = StopBits.One; - comPort.BaudRate = 9600; - - comPort.Open(); - - return comPort.IsOpen; - } - - public Boolean Disconnect() - { - comPort.Close(); - return !comPort.IsOpen; - } - - public Boolean IsOpen() - { - if (comPort != null) - return comPort.IsOpen; - else - return false; - } - - public void Write(string input) - { - if (IsOpen()) - { - comPort.WriteLine(input); - } - } - - public string Read() - { - if (IsOpen()) - { - return comPort.ReadLine(); - } - - return ""; - } - } -} diff --git a/ErgometerApplication/ErgometerApplication/Ergometer.cs b/ErgometerApplication/ErgometerApplication/Ergometer.cs index deb03eb..130bd34 100644 --- a/ErgometerApplication/ErgometerApplication/Ergometer.cs +++ b/ErgometerApplication/ErgometerApplication/Ergometer.cs @@ -11,6 +11,7 @@ using System.Threading.Tasks; using System.Windows.Forms; using Newtonsoft.Json; using System.IO; +using ErgometerLibrary; namespace ErgometerApplication { @@ -55,7 +56,7 @@ namespace ErgometerApplication string response = comPort.Read(); Console.WriteLine(response); - Meting m = FormatHelper.Status(response); + Meting m = Meting.Parse(response); SaveData(m); richTextBox1.Text = m.ToString(); } @@ -90,7 +91,7 @@ namespace ErgometerApplication comPort.Write("ST"); string response = comPort.Read(); Console.WriteLine(response); - Meting m = FormatHelper.Status(response); + Meting m = Meting.Parse(response); SaveData(m); richTextBox1.Text = m.ToString(); @@ -113,7 +114,7 @@ namespace ErgometerApplication comPort.Write("ST"); string response = comPort.Read(); Console.WriteLine(response); - Meting m = FormatHelper.Status(response); + Meting m = Meting.Parse(response); SaveData(m); richTextBox1.Text = m.ToString(); } diff --git a/ErgometerApplication/ErgometerApplication/ErgometerApplication.csproj b/ErgometerApplication/ErgometerApplication/ErgometerApplication.csproj index a54bb55..38b0c00 100644 --- a/ErgometerApplication/ErgometerApplication/ErgometerApplication.csproj +++ b/ErgometerApplication/ErgometerApplication/ErgometerApplication.csproj @@ -33,6 +33,9 @@ 4 + + ..\..\..\ErgometerLibrary\ErgometerLibrary\ErgometerLibrary\bin\Debug\ErgometerLibrary.dll + ..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll True @@ -50,9 +53,6 @@ - - - Form @@ -87,6 +87,9 @@ + + +