diff --git a/ErgometerSimulator/ErgometerSimulator/CommandParser.cs b/ErgometerSimulator/ErgometerSimulator/CommandParser.cs index 0180f51..5210276 100644 --- a/ErgometerSimulator/ErgometerSimulator/CommandParser.cs +++ b/ErgometerSimulator/ErgometerSimulator/CommandParser.cs @@ -39,7 +39,30 @@ namespace ErgometerSimulator default: break; } - + if (input.StartsWith("PT")) + { + dg.Time.currentvalue = int.Parse(input.Substring(3, 2)) * 60 + int.Parse(input.Substring(5, 2)); + dg.Time.value1 = int.Parse(input.Substring(3,2)) * 60 + int.Parse(input.Substring(5,2)); + Console.WriteLine(dg.Time.currentvalue); + } + else if (input.StartsWith("PD")) + { + dg.Distance.currentvalue = int.Parse(input.Substring(3)); + dg.Distance.value1 = int.Parse(input.Substring(3)); + Console.WriteLine(dg.Distance.currentvalue); + } + else if (input.StartsWith("PW")) + { + dg.Power.currentvalue = int.Parse(input.Substring(3)); + dg.Power.value1 = int.Parse(input.Substring(3)); + Console.WriteLine(dg.Power.currentvalue); + } + else if (input.StartsWith("PE")) + { + dg.Energy.currentvalue = int.Parse(input.Substring(3)); + dg.Energy.value1 = int.Parse(input.Substring(3)); + Console.WriteLine(dg.Energy.currentvalue); + } return response; } } diff --git a/ErgometerSimulator/ErgometerSimulator/ErgometerSimulator.Designer.cs b/ErgometerSimulator/ErgometerSimulator/ErgometerSimulator.Designer.cs index 847bc62..992115a 100644 --- a/ErgometerSimulator/ErgometerSimulator/ErgometerSimulator.Designer.cs +++ b/ErgometerSimulator/ErgometerSimulator/ErgometerSimulator.Designer.cs @@ -96,9 +96,7 @@ namespace ErgometerSimulator // ComPortBox // this.ComPortBox.FormattingEnabled = true; - this.ComPortBox.Items.AddRange(new object[] { - "COM8", - "COM9"}); + this.ComPortBox.Items.AddRange(SerialPort.GetPortNames()); this.ComPortBox.Location = new System.Drawing.Point(15, 308); this.ComPortBox.Name = "ComPortBox"; this.ComPortBox.Size = new System.Drawing.Size(121, 24);