diff --git a/ErgometerApplication/.vs/ErgometerApplication/v14/.suo b/ErgometerApplication/.vs/ErgometerApplication/v14/.suo index ea97c36..2cf926d 100644 Binary files a/ErgometerApplication/.vs/ErgometerApplication/v14/.suo and b/ErgometerApplication/.vs/ErgometerApplication/v14/.suo differ diff --git a/ErgometerApplication/ErgometerApplication/MainClient.cs b/ErgometerApplication/ErgometerApplication/MainClient.cs index 3f9806f..33aecf0 100644 --- a/ErgometerApplication/ErgometerApplication/MainClient.cs +++ b/ErgometerApplication/ErgometerApplication/MainClient.cs @@ -51,6 +51,35 @@ namespace ErgometerApplication { error = "Succes"; + if (!ComPort.IsOpen()) + { + if (ComPort.Connect(comport)) + { + ComPort.Write("RS"); + string temp = ComPort.Read(); + if (temp == "error") + { + ComPort.Disconnect(); + error = "De Ergometer is niet verbonden"; + return false; + } + Thread.Sleep(200); + ComPort.Write("CM"); + ComPort.Read(); + Thread.Sleep(200); + + ComPort.Write("ST"); + string response = ComPort.Read(); + + SaveMeting(response); + } + else + { + error = "De ergometer is niet verbonden"; + return false; + } + } + if (Doctor == null || !Doctor.Connected) { if (Doctor == null) @@ -97,29 +126,6 @@ namespace ErgometerApplication Loggedin = true; } - if (!ComPort.IsOpen()) - { - if (ComPort.Connect(comport)) - { - ComPort.Write("RS"); - ComPort.Read(); - Thread.Sleep(200); - ComPort.Write("CM"); - ComPort.Read(); - Thread.Sleep(200); - - ComPort.Write("ST"); - string response = ComPort.Read(); - - SaveMeting(response); - } - else - { - error = "De ergometer is niet verbonden"; - return false; - } - } - return true; } diff --git a/ErgometerApplication/ErgometerApplication/bin/Debug/ErgometerLibrary.dll b/ErgometerApplication/ErgometerApplication/bin/Debug/ErgometerLibrary.dll index 8ef32a7..bdeafa8 100644 Binary files a/ErgometerApplication/ErgometerApplication/bin/Debug/ErgometerLibrary.dll and b/ErgometerApplication/ErgometerApplication/bin/Debug/ErgometerLibrary.dll differ