";
+ }
+ private string getTableHeadEnum()
+ {
+ return " | Return | Name | Description |
";
+ }
+ private string getTableTail()
+ {
+ return "
";
+ }
+ private string findReturnType(string fieldname)
+ {
+ if (fieldname.IndexOf('+') >= 0)
+ {
+ return fieldname.Split('+')[1];
+ }
+ else return fieldname;
+ }
+
+ private string getMethodReturnType(Type source, MemberInfo member)
+ {
+ switch (member.MemberType)
+ {
+ case MemberTypes.Method:
+ var met = source.GetMethod(member.Name);
+ return source.GetMethod(member.Name).ReturnType.ToString().Substring(7);
+ case MemberTypes.Property:
+ var pt = source.GetProperty(member.Name);
+ if (pt != null)
+ return pt.PropertyType.FullName.Substring(7);
+ break;
+ case MemberTypes.Field:
+ var fd = source.GetField(member.Name);
+ string fieldname = fd.FieldType.FullName.Substring(7);
+ return findReturnType(fieldname);
+ }
+ return "";
+
+ }
+ ///
+ /// HTML 메뉴얼작성용 코드를 생성합니다.(0==command,1==enum,2==structure)
+ ///
+ public string MakeHTML(byte type = 0)
+ {
+ System.Text.StringBuilder sb = new StringBuilder();
+
+ sb.AppendLine(getHtmlHeader());
+
+ if (type == 2)
+ {
+
+ var typeSmsg = typeof(sRecvMessage);
+ sb.AppendLine("[ " + typeSmsg.Name + " ]
");
+ sb.AppendLine(getTableHeadStr());
+ foreach (var member in typeSmsg.GetMembers())
+ {
+ if (member.Name.StartsWith("get_") || member.Name.StartsWith("set_") ||
+ member.Name.StartsWith("Equals") || member.Name.StartsWith("GetHashCode") ||
+ member.Name.StartsWith("GetType")) continue;
+
+ sb.AppendLine("");
+ sb.AppendLine(" | " + member.MemberType.ToString() + " | ");
+ sb.AppendLine(" " + member.Name + " | ");
+ sb.AppendLine(" " + getMethodReturnType(typeSmsg, member) + " | ");
+ sb.AppendLine(" " + member.Name + " | ");
+ sb.AppendLine("
");
+ }
+ sb.AppendLine(getTableTail());
+
+ }
+ else if (type == 1)
+ {
+ //enum list
+
+ var typeeIO = typeof(eIOPINDIR);
+ sb.AppendLine("[ " + typeeIO.Name + " ]
");
+ sb.AppendLine(getTableHeadEnum());
+ foreach (var member in typeeIO.GetFields())
+ {
+ if (member.Name.StartsWith("get_") || member.Name.StartsWith("set_") ||
+ member.Name.StartsWith("Equals") || member.Name.StartsWith("GetHashCode") ||
+ member.Name.StartsWith("GetType") || member.Name.EndsWith("__")) continue;
+
+ sb.AppendLine("");
+ sb.AppendLine(" | Byte | ");
+ sb.AppendLine(" " + member.Name + " | ");
+ sb.AppendLine(" " + member.Name + " | ");
+ sb.AppendLine("
");
+ }
+ sb.AppendLine(getTableTail());
+
+ typeeIO = typeof(eErrorCode);
+ sb.AppendLine("[ " + typeeIO.Name + " ]
");
+ sb.AppendLine(getTableHeadEnum());
+ foreach (var member in typeeIO.GetFields())
+ {
+ if (member.Name.StartsWith("get_") || member.Name.StartsWith("set_") ||
+ member.Name.StartsWith("Equals") || member.Name.StartsWith("GetHashCode") ||
+ member.Name.StartsWith("GetType") || member.Name.EndsWith("__")) continue;
+
+ sb.AppendLine("");
+ sb.AppendLine(" | Byte | ");
+ sb.AppendLine(" " + member.Name + " | ");
+ sb.AppendLine(" " + member.Name + " | ");
+ sb.AppendLine("
");
+ }
+ sb.AppendLine(getTableTail());
+
+ typeeIO = typeof(eOpCode);
+ sb.AppendLine("[ " + typeeIO.Name + " ]
");
+ sb.AppendLine(getTableHeadEnum());
+ foreach (var member in typeeIO.GetFields())
+ {
+ if (member.Name.StartsWith("get_") || member.Name.StartsWith("set_") ||
+ member.Name.StartsWith("Equals") || member.Name.StartsWith("GetHashCode") ||
+ member.Name.StartsWith("GetType") || member.Name.EndsWith("__")) continue;
+
+ sb.AppendLine("");
+ sb.AppendLine(" | Byte | ");
+ sb.AppendLine(" " + member.Name + " | ");
+ sb.AppendLine(" " + member.Name + " | ");
+ sb.AppendLine("
");
+ }
+ sb.AppendLine(getTableTail());
+ }
+ else
+ {
+ //main
+ sb.AppendLine("[ Methods ]
");
+ sb.AppendLine(getTableHead());
+ foreach (var member in GetType().GetMethods())
+ {
+ if (member.Name.StartsWith("get_") || member.Name.StartsWith("set_") ||
+ member.Name.StartsWith("Equals") || member.Name.StartsWith("GetHashCode") ||
+ member.Name.StartsWith("GetType") || member.Name.StartsWith("add_") ||
+ member.Name.StartsWith("remove_")) continue;
+
+ sb.AppendLine("");
+ sb.AppendLine(" | " + findReturnType(member.ReturnType.ToString().Substring(7)) + " | ");
+ sb.AppendLine(" " + member.Name + " | ");
+ sb.AppendLine(" " + member.Name + " | ");
+ sb.AppendLine("
");
+ }
+ sb.AppendLine(getTableTail());
+
+
+ sb.AppendLine("[ Properties ]
");
+ sb.AppendLine(getTableHead());
+ foreach (var member in GetType().GetProperties())
+ {
+ if (member.Name.StartsWith("get_") || member.Name.StartsWith("set_") ||
+ member.Name.StartsWith("Equals") || member.Name.StartsWith("GetHashCode") ||
+ member.Name.StartsWith("GetType") || member.Name.StartsWith("add_") ||
+ member.Name.StartsWith("remove_")) continue;
+ sb.AppendLine("");
+ sb.AppendLine(" | " + findReturnType(member.PropertyType.FullName.Substring(7)) + " | ");
+ sb.AppendLine(" " + member.Name + " | ");
+ sb.AppendLine(" " + member.Name + " | ");
+ sb.AppendLine("
");
+ }
+ sb.AppendLine(getTableTail());
+
+
+ sb.AppendLine("[ Events ]
");
+ sb.AppendLine(getTableHead());
+ foreach (var member in GetType().GetEvents())
+ {
+ if (member.Name.StartsWith("get_") || member.Name.StartsWith("set_") ||
+ member.Name.StartsWith("Equals") || member.Name.StartsWith("GetHashCode") ||
+ member.Name.StartsWith("GetType") || member.Name.StartsWith("add_") ||
+ member.Name.StartsWith("remove_")) continue;
+
+ sb.AppendLine("");
+ sb.AppendLine(" | " + "" + " | ");
+ sb.AppendLine(" " + member.Name + " | ");
+ sb.AppendLine(" " + member.Name + " | ");
+ sb.AppendLine("
");
+ }
+ sb.AppendLine(getTableTail());
+
+
+
+ sb.AppendLine("[ Fields ]
");
+ sb.AppendLine(getTableHead());
+ foreach (var member in GetType().GetFields())
+ {
+ if (member.Name.StartsWith("get_") || member.Name.StartsWith("set_") ||
+ member.Name.StartsWith("Equals") || member.Name.StartsWith("GetHashCode") ||
+ member.Name.StartsWith("GetType") || member.Name.StartsWith("add_") ||
+ member.Name.StartsWith("remove_")) continue;
+
+ sb.AppendLine("");
+ sb.AppendLine(" | " + findReturnType(member.FieldType.FullName.Substring(7)) + " | ");
+ sb.AppendLine(" " + member.Name + " | ");
+ sb.AppendLine(" " + member.Name + " | ");
+ sb.AppendLine("
");
+ }
+ sb.AppendLine(getTableTail());
+ }
+
+ sb.AppendLine(getHtmlTail());
+ return sb.ToString();
+ }
+ #endregion
+
+
+ }
+}
diff --git a/Sub/arMasterK/Project/Write.cs b/Sub/arMasterK/Project/Write.cs
new file mode 100644
index 0000000..8e8d87d
--- /dev/null
+++ b/Sub/arMasterK/Project/Write.cs
@@ -0,0 +1,213 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.ComponentModel;
+using System.Windows.Forms;
+using System.Drawing;
+using System.Drawing.Design;
+using System.Reflection;
+using System.Runtime;
+using System.Runtime.InteropServices;
+using System.Threading.Tasks;
+
+//for tcp,udp
+using System.Net.Sockets;
+using System.Net;
+
+namespace arDev
+{
+ public partial class MasterK
+ {
+
+ protected Boolean Send(byte[] packet)
+ {
+ try
+ {
+ _device.DiscardInBuffer();
+ System.Threading.Thread.Sleep(1);
+ _device.DiscardOutBuffer();
+ System.Threading.Thread.Sleep(1);
+ _device.Write(packet, 0, packet.Length);
+ char_tmo = 0;
+ return true;
+ }
+ catch (Exception ex)
+ {
+ RaiseMessage(true, "Device Send Error : " + ex.Message);
+ return false;
+ }
+ }
+
+ protected Boolean Write(byte[] packet)
+ {
+ bSyncRecvOK = false;
+ errorMessage = string.Empty;
+ lastSendTime = DateTime.Now;
+ lastSendMessage = Parse_SendBuffer(packet);
+ Boolean retval = Send(packet);
+ if (!retval) RaiseMessage(true, "Tx Error : " + System.Text.Encoding.Default.GetString(packet));
+ else RaiseDataMessage(eMsgType.Tx, packet);
+ return retval;
+ }
+ public byte[] UserWrite(string command)
+ {
+ _mre.Reset();
+ var buffer = WriteSync(command);
+ _mre.Set();
+ return buffer;
+ }
+
+ protected byte[] WriteSync(string command)
+ {
+ var bytes = System.Text.Encoding.Default.GetBytes(command);
+ if (command[0] == (char)wSTX)
+ {
+ return WriteSync(bytes);
+ }
+ else
+ {
+ List packet = new List();
+ packet.Add(wSTX);
+ packet.AddRange(bytes);
+ packet.Add(wETX);
+ return WriteSync(packet.ToArray());
+ }
+ }
+ protected int interframe_delay;
+ System.Diagnostics.Stopwatch sw_ch;
+ long char_tmo;
+
+ string savefil = string.Empty;
+
+ // Int64 writeCnt = 0;
+ protected byte[] WriteSync(byte[] command)
+ {
+ //writeCnt += 1;
+ //RaiseMessage(false, ">> WriteSync Enter " + writeCnt.ToString());
+ if (savefil == "")
+ {
+ savefil = Environment.CurrentDirectory + "\rxBuffer.txt";
+ }
+ // if (!mre.WaitOne(500))
+ // {
+ // errorMessage = "WaitOne error 500ms";
+ // return null;
+ // }
+
+ //// RaiseMessage(false, "write data sync");
+
+ // mre.Reset();
+
+
+ //Boolean isComplete = false;
+ Boolean isTimeOut = false;
+ errorMessage = "Wait Data #2";
+
+ LastRecvMessage.Clear();
+ List _buffer = new List();
+ wat.Restart();
+
+ System.Threading.Thread.Sleep(interframe_delay);
+
+ //send data
+ if (!Write(command))
+ {
+ errorMessage = "sync Buffer is null(1)";
+ //mre.Set();
+ //RaiseMessage(false, "<< WriteSync Out " + writeCnt.ToString());
+ return null;
+ }
+
+ bool done = false;
+ System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
+ sw.Start();
+ int rcv ;
+ long tmo = 0;
+ do
+ {
+ int buffercnt = 0;
+ try
+ {
+ buffercnt = _device.BytesToRead;
+ }
+ catch (Exception ex)
+ {
+ RaiseMessage(true, ex.Message);
+ }
+
+ if (buffercnt > 0)
+ {
+ try
+ {
+ rcv = _device.ReadByte();
+ // System.IO.File.WriteAllBytes(savefil, new byte[] { (byte)rcv });
+ RaiseDataMessage(eMsgType.RxRaw, new byte[(byte)rcv]);
+
+ if (rcv == 0x06 || rcv == 0x015)
+ {
+ _buffer.Clear();
+ _buffer.Add((byte)rcv);
+ //isComplete = false;
+ }
+ else if (rcv == 0x03) //endtext
+ {
+ //모두 수신한경우이다.
+ _buffer.Add((byte)rcv);
+ //isComplete = true;
+ done = true;
+ break;
+ }
+ else
+ {
+ _buffer.Add((byte)rcv);
+ }
+ }
+ catch {
+
+ }
+ }
+ tmo = sw.ElapsedMilliseconds;
+ } while ((!done) && (_device.ReadTimeout > tmo));
+ sw_ch.Stop();
+ sw.Stop();
+
+ if (tmo >= _device.ReadTimeout)
+ {
+ errorMessage = string.Format("Writesync TimeOut({0})", _device.ReadTimeout);
+ isTimeOut = true;
+ }
+
+ byte[] Dummy = new byte[_buffer.Count];
+ _buffer.CopyTo(Dummy);
+
+ // mre.Set();
+ if (isTimeOut)
+ {
+ RaiseMessage(true, errorMessage);
+ //RaiseMessage(false, "<< WriteSync Out " + writeCnt.ToString());
+ return null;
+ }
+ else
+ {
+ RaiseDataMessage(eMsgType.Rx, Dummy);
+ var frame = Parse_RecvBuffer(Dummy);
+ if (frame.Buffer == null)
+ {
+ errorMessage = "sync buffer is null(2)";
+ RaiseMessage(true, errorMessage);
+ // RaiseMessage(false, "<< WriteSync Out " + writeCnt.ToString());
+ return null;
+ }
+ else
+ {
+ // RaiseMessage(false, "<< WriteSync Out " + writeCnt.ToString());
+ return frame.Buffer;
+ }
+ }
+ }
+
+ }
+
+}
diff --git a/Sub/arMasterK/Project/arMasterK.csproj b/Sub/arMasterK/Project/arMasterK.csproj
new file mode 100644
index 0000000..18f658e
--- /dev/null
+++ b/Sub/arMasterK/Project/arMasterK.csproj
@@ -0,0 +1,100 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {E0133085-E5F9-4275-9DB8-F8F20EF8561F}
+ Library
+ Properties
+ arDev
+ arMasterK
+ v4.8
+ 512
+
+
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+ false
+
+
+ AnyCPU
+ pdbonly
+ true
+ ..\..\DLL\
+ TRACE
+ prompt
+ 4
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Form
+
+
+ fIOMonitor.cs
+
+
+
+
+
+ fIOMonitor.cs
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+ Designer
+
+
+ True
+ Resources.resx
+ True
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+ True
+ Settings.settings
+ True
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Sub/arMasterK/Project/fIOMonitor.Designer.cs b/Sub/arMasterK/Project/fIOMonitor.Designer.cs
new file mode 100644
index 0000000..1a29023
--- /dev/null
+++ b/Sub/arMasterK/Project/fIOMonitor.Designer.cs
@@ -0,0 +1,144 @@
+namespace arDev
+{
+ partial class fIOMonitor
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
+ this.label1 = new System.Windows.Forms.Label();
+ this.label2 = new System.Windows.Forms.Label();
+ this.tblOutput = new System.Windows.Forms.TableLayoutPanel();
+ this.tblINput = new System.Windows.Forms.TableLayoutPanel();
+ this.tableLayoutPanel1.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // tableLayoutPanel1
+ //
+ this.tableLayoutPanel1.ColumnCount = 2;
+ this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
+ this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
+ this.tableLayoutPanel1.Controls.Add(this.label1, 0, 0);
+ this.tableLayoutPanel1.Controls.Add(this.label2, 1, 0);
+ this.tableLayoutPanel1.Controls.Add(this.tblOutput, 1, 1);
+ this.tableLayoutPanel1.Controls.Add(this.tblINput, 0, 1);
+ this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
+ this.tableLayoutPanel1.Name = "tableLayoutPanel1";
+ this.tableLayoutPanel1.RowCount = 2;
+ this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 36F));
+ this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
+ this.tableLayoutPanel1.Size = new System.Drawing.Size(582, 480);
+ this.tableLayoutPanel1.TabIndex = 0;
+ //
+ // label1
+ //
+ this.label1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.label1.Location = new System.Drawing.Point(3, 0);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(285, 36);
+ this.label1.TabIndex = 0;
+ this.label1.Text = "INPUT";
+ this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ //
+ // label2
+ //
+ this.label2.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.label2.Location = new System.Drawing.Point(294, 0);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(285, 36);
+ this.label2.TabIndex = 0;
+ this.label2.Text = "OUTPUT";
+ this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ //
+ // tblOutput
+ //
+ this.tblOutput.ColumnCount = 4;
+ this.tblOutput.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
+ this.tblOutput.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
+ this.tblOutput.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
+ this.tblOutput.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
+ this.tblOutput.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.tblOutput.Location = new System.Drawing.Point(294, 39);
+ this.tblOutput.Name = "tblOutput";
+ this.tblOutput.RowCount = 8;
+ this.tblOutput.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 12.5F));
+ this.tblOutput.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 12.5F));
+ this.tblOutput.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 12.5F));
+ this.tblOutput.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 12.5F));
+ this.tblOutput.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 12.5F));
+ this.tblOutput.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 12.5F));
+ this.tblOutput.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 12.5F));
+ this.tblOutput.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 12.5F));
+ this.tblOutput.Size = new System.Drawing.Size(285, 438);
+ this.tblOutput.TabIndex = 1;
+ //
+ // tblINput
+ //
+ this.tblINput.ColumnCount = 4;
+ this.tblINput.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
+ this.tblINput.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
+ this.tblINput.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
+ this.tblINput.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
+ this.tblINput.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.tblINput.Location = new System.Drawing.Point(3, 39);
+ this.tblINput.Name = "tblINput";
+ this.tblINput.RowCount = 8;
+ this.tblINput.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 12.5F));
+ this.tblINput.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 12.5F));
+ this.tblINput.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 12.5F));
+ this.tblINput.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 12.5F));
+ this.tblINput.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 12.5F));
+ this.tblINput.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 12.5F));
+ this.tblINput.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 12.5F));
+ this.tblINput.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 12.5F));
+ this.tblINput.Size = new System.Drawing.Size(285, 438);
+ this.tblINput.TabIndex = 1;
+ //
+ // fIOMonitor
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(582, 480);
+ this.Controls.Add(this.tableLayoutPanel1);
+ this.Name = "fIOMonitor";
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
+ this.Text = "fIOMonitor";
+ this.Load += new System.EventHandler(this.fIOMonitor_Load);
+ this.tableLayoutPanel1.ResumeLayout(false);
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.TableLayoutPanel tblOutput;
+ private System.Windows.Forms.TableLayoutPanel tblINput;
+ }
+}
\ No newline at end of file
diff --git a/Sub/arMasterK/Project/fIOMonitor.cs b/Sub/arMasterK/Project/fIOMonitor.cs
new file mode 100644
index 0000000..de728ca
--- /dev/null
+++ b/Sub/arMasterK/Project/fIOMonitor.cs
@@ -0,0 +1,77 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace arDev
+{
+ public partial class fIOMonitor : Form
+ {
+ MasterK dio;
+ public fIOMonitor(MasterK _device)
+ {
+ InitializeComponent();
+ dio = _device;
+ }
+
+ Button[] btInput;
+ Button[] btOutput;
+ private void fIOMonitor_Load(object sender, EventArgs e)
+ {
+ btInput = new Button[dio.DICount];
+ btOutput = new Button[dio.DOCount];
+ for(int i = 0; i< dio.DICount;i++)
+ {
+ Button lb = new Button();
+ lb.Text = string.Format("{0}",i+1);
+ lb.Tag = i;
+ lb.Click += lb_ClickI;
+ lb.Dock = DockStyle.Fill;
+ lb.BackColor = dio.INPUT(i) ? Color.Lime : Color.White;
+ btInput[i] = lb;
+ this.tblINput.Controls.Add(lb);
+ }
+ for (int i = 0; i < dio.DOCount; i++)
+ {
+ Button lb = new Button();
+ lb.Text = string.Format("{0}", i + 1);
+ lb.Tag = i;
+ lb.Click += lb_ClickO;
+ lb.Dock = DockStyle.Fill;
+ lb.BackColor = dio.OUTPUT(i) ? Color.Lime : Color.White;
+ btOutput[i] = lb;
+ this.tblOutput.Controls.Add(lb);
+ }
+
+ dio.IOValueChanged += dio_IOValueChanged;
+ }
+
+ void dio_IOValueChanged(object sender, MasterK.IOValueEventArgs e)
+ {
+ if(e.Direction == MasterK.eIOPINDIR.INPUT)
+ {
+ btInput[e.ArrIDX].BackColor = e.NewValue ? Color.Lime : Color.White;
+ }
+ else
+ {
+ btOutput[e.ArrIDX].BackColor = e.NewValue ? Color.Lime : Color.White;
+ }
+ }
+ void lb_ClickI(object sender, EventArgs e)
+ {
+ var bt = sender as Button;
+ //MessageBox.Show("input click : " + bt.Tag.ToString());
+ }
+ void lb_ClickO(object sender, EventArgs e)
+ {
+ var bt = sender as Button;
+ var idx = int.Parse(bt.Tag.ToString());
+ dio.SetToggle(idx);
+ }
+ }
+}
diff --git a/Sub/arMasterK/Project/fIOMonitor.resx b/Sub/arMasterK/Project/fIOMonitor.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/Sub/arMasterK/Project/fIOMonitor.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file