Преглед на файлове

last commit before changing to desktop pc

Bart Reedijk преди 10 години
родител
ревизия
3bddcd253d

+ 19 - 0
Proftaak Remote Healthcare/Fietsclient/KettlerBikeComm.cs

@@ -4,6 +4,7 @@ using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 using System.IO.Ports;
+using System.Threading;
 
 namespace Fietsclient
 {
@@ -11,6 +12,8 @@ namespace Fietsclient
     {
         private string _portname;
         private int baudrate = 9600;
+        private string _bufferOut;
+        private string[] _bufferIn;
 
 
         private SerialPort ComPort;
@@ -27,6 +30,22 @@ namespace Fietsclient
             ComPort.WriteLine("RS");
             Console.Write(ComPort.ReadLine());
             Console.WriteLine("end of message");
+            ComPort.DataReceived += new SerialDataReceivedEventHandler(ComPort_DataReceived);
+
+            while(true)
+            {
+                Thread.Sleep(1000);
+                ComPort.WriteLine("ST");
+            }
+        }
+
+        private void ComPort_DataReceived(object sender, SerialDataReceivedEventArgs e)
+        {
+            string buffer = ComPort.ReadLine();
+            buffer = buffer.TrimEnd('\r');
+            Console.WriteLine(buffer);
+            _bufferIn = buffer.Split('\t');
+            
         }
     }
 }

+ 18 - 2
Proftaak Remote Healthcare/Fietsclient/MainForm.Designer.cs

@@ -29,11 +29,12 @@
         private void InitializeComponent()
         {
             this.button1 = new System.Windows.Forms.Button();
+            this.textBox1 = new System.Windows.Forms.TextBox();
             this.SuspendLayout();
             // 
             // button1
             // 
-            this.button1.Location = new System.Drawing.Point(41, 28);
+            this.button1.Location = new System.Drawing.Point(12, 12);
             this.button1.Name = "button1";
             this.button1.Size = new System.Drawing.Size(75, 23);
             this.button1.TabIndex = 0;
@@ -41,21 +42,36 @@
             this.button1.UseVisualStyleBackColor = true;
             this.button1.Click += new System.EventHandler(this.button1_Click);
             // 
+            // textBox1
+            // 
+            this.textBox1.BackColor = System.Drawing.Color.Black;
+            this.textBox1.ForeColor = System.Drawing.Color.White;
+            this.textBox1.Location = new System.Drawing.Point(12, 237);
+            this.textBox1.Multiline = true;
+            this.textBox1.Name = "textBox1";
+            this.textBox1.ReadOnly = true;
+            this.textBox1.Size = new System.Drawing.Size(544, 92);
+            this.textBox1.TabIndex = 1;
+            // 
             // MainForm
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(284, 261);
+            this.AutoScroll = true;
+            this.ClientSize = new System.Drawing.Size(568, 341);
+            this.Controls.Add(this.textBox1);
             this.Controls.Add(this.button1);
             this.Name = "MainForm";
             this.Text = "Form1";
             this.ResumeLayout(false);
+            this.PerformLayout();
 
         }
 
         #endregion
 
         private System.Windows.Forms.Button button1;
+        private System.Windows.Forms.TextBox textBox1;
     }
 }
 

+ 2 - 0
Proftaak Remote Healthcare/Fietsclient/MainForm.cs

@@ -24,5 +24,7 @@ namespace Fietsclient
         {
             _global.startComPort();
         }
+
+
     }
 }