diff --git a/DeviceAdapter/DeviceAdapter.cs b/DeviceAdapter/DeviceAdapter.cs
index 35e05dd..e0ce010 100644
--- a/DeviceAdapter/DeviceAdapter.cs
+++ b/DeviceAdapter/DeviceAdapter.cs
@@ -95,6 +95,12 @@ namespace Mesnac.DeviceAdapter
/// 连接字符串 当iCommType为1时,pUrl格式“192.168.1.100:23”,为2时,pUrl格式为:“Com1:9600“
/// 详见DeviceType
bool Device_Init_Id(CommType iCommType, string pUrl, UInt16 iDeviceId);
+ ///
+ /// 判断设备状态
+ ///
+ ///
+
+ bool GetOnlineStatus();
///
/// 连接设备
@@ -215,6 +221,15 @@ namespace Mesnac.DeviceAdapter
/// 天线号,0为本机,255为读取所有天线
UInt16 Device_GetIdentifyData(ref Byte[] pReadData, Byte Antenna);
+ ///
+ /// 获取天线收发功率
+ ///
+ ///
+ ///
+ ///
+ ///
+ int Device_GetRf(byte Antenna, WriteOrRead RorW);
+
///
/// 设置天线收发功率
///
diff --git a/HighWayAssemble/App.config b/HighWayAssemble/App.config
index 906dfec..96d0c6d 100644
--- a/HighWayAssemble/App.config
+++ b/HighWayAssemble/App.config
@@ -182,6 +182,14 @@
+
+
+
+
+
+
+
+
diff --git a/HighWayAssemble/FrmDisplayView.Designer.cs b/HighWayAssemble/FrmDisplayView.Designer.cs
index c7e8612..0a43c29 100644
--- a/HighWayAssemble/FrmDisplayView.Designer.cs
+++ b/HighWayAssemble/FrmDisplayView.Designer.cs
@@ -38,13 +38,21 @@
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
this.groupBox1 = new System.Windows.Forms.GroupBox();
+ this.groupBox2 = new System.Windows.Forms.GroupBox();
+ this.groupBox3 = new System.Windows.Forms.GroupBox();
+ this.timer1 = new System.Windows.Forms.Timer(this.components);
+ this.label_Version = new System.Windows.Forms.Label();
+ this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
+ this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
+ this.显示ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.退出ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.label_CollectID = new System.Windows.Forms.Label();
this.adapter_list = new HighWayAssemble.DoubleBufferListView();
this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader4 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader5 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.groupBox2 = new System.Windows.Forms.GroupBox();
this.equip_list = new HighWayAssemble.DoubleBufferListView();
this.columnHeader6 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader7 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
@@ -53,7 +61,6 @@
this.columnHeader10 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader16 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader17 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.groupBox3 = new System.Windows.Forms.GroupBox();
this.sensor_list = new HighWayAssemble.DoubleBufferListView();
this.columnHeader11 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader12 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
@@ -63,13 +70,9 @@
this.columnHeader19 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader20 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader21 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.timer1 = new System.Windows.Forms.Timer(this.components);
- this.label_Version = new System.Windows.Forms.Label();
- this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
- this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
- this.显示ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.退出ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.label_CollectID = new System.Windows.Forms.Label();
+ this.contextMenuStrip2 = new System.Windows.Forms.ContextMenuStrip(this.components);
+ this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
+ this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip1.SuspendLayout();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
@@ -84,6 +87,7 @@
this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout();
this.contextMenuStrip1.SuspendLayout();
+ this.contextMenuStrip2.SuspendLayout();
this.SuspendLayout();
//
// menuStrip1
@@ -103,7 +107,7 @@
// 菜单ToolStripMenuItem
//
this.菜单ToolStripMenuItem.Name = "菜单ToolStripMenuItem";
- this.菜单ToolStripMenuItem.Size = new System.Drawing.Size(62, 28);
+ this.菜单ToolStripMenuItem.Size = new System.Drawing.Size(62, 32);
this.菜单ToolStripMenuItem.Text = "菜单";
//
// 关于ToolStripMenuItem
@@ -111,7 +115,7 @@
this.关于ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.v20230913ToolStripMenuItem});
this.关于ToolStripMenuItem.Name = "关于ToolStripMenuItem";
- this.关于ToolStripMenuItem.Size = new System.Drawing.Size(62, 28);
+ this.关于ToolStripMenuItem.Size = new System.Drawing.Size(62, 32);
this.关于ToolStripMenuItem.Text = "关于";
//
// v20230913ToolStripMenuItem
@@ -182,52 +186,6 @@
this.groupBox1.TabStop = false;
this.groupBox1.Text = "MES软件";
//
- // adapter_list
- //
- this.adapter_list.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
- this.columnHeader1,
- this.columnHeader2,
- this.columnHeader3,
- this.columnHeader4,
- this.columnHeader5});
- this.adapter_list.Dock = System.Windows.Forms.DockStyle.Fill;
- this.adapter_list.HideSelection = false;
- this.adapter_list.Location = new System.Drawing.Point(4, 26);
- this.adapter_list.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
- this.adapter_list.Name = "adapter_list";
- this.adapter_list.Size = new System.Drawing.Size(263, 261);
- this.adapter_list.TabIndex = 0;
- this.adapter_list.UseCompatibleStateImageBehavior = false;
- this.adapter_list.View = System.Windows.Forms.View.Details;
- //
- // columnHeader1
- //
- this.columnHeader1.Text = "编号";
- this.columnHeader1.Width = 40;
- //
- // columnHeader2
- //
- this.columnHeader2.Text = "名称";
- this.columnHeader2.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
- this.columnHeader2.Width = 80;
- //
- // columnHeader3
- //
- this.columnHeader3.Text = "IP地址";
- this.columnHeader3.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
- this.columnHeader3.Width = 100;
- //
- // columnHeader4
- //
- this.columnHeader4.Text = "端口号";
- this.columnHeader4.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
- //
- // columnHeader5
- //
- this.columnHeader5.Text = "连接状态";
- this.columnHeader5.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
- this.columnHeader5.Width = 97;
- //
// groupBox2
//
this.groupBox2.Controls.Add(this.equip_list);
@@ -241,63 +199,6 @@
this.groupBox2.TabStop = false;
this.groupBox2.Text = "设备信息";
//
- // equip_list
- //
- this.equip_list.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
- this.columnHeader6,
- this.columnHeader7,
- this.columnHeader8,
- this.columnHeader9,
- this.columnHeader10,
- this.columnHeader16,
- this.columnHeader17});
- this.equip_list.Dock = System.Windows.Forms.DockStyle.Fill;
- this.equip_list.HideSelection = false;
- this.equip_list.Location = new System.Drawing.Point(4, 26);
- this.equip_list.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
- this.equip_list.Name = "equip_list";
- this.equip_list.Size = new System.Drawing.Size(1140, 261);
- this.equip_list.TabIndex = 1;
- this.equip_list.UseCompatibleStateImageBehavior = false;
- this.equip_list.View = System.Windows.Forms.View.Details;
- //
- // columnHeader6
- //
- this.columnHeader6.Text = "编号";
- this.columnHeader6.Width = 50;
- //
- // columnHeader7
- //
- this.columnHeader7.Text = "名称";
- this.columnHeader7.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
- this.columnHeader7.Width = 120;
- //
- // columnHeader8
- //
- this.columnHeader8.Text = "连接串";
- this.columnHeader8.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
- this.columnHeader8.Width = 120;
- //
- // columnHeader9
- //
- this.columnHeader9.Text = "连接方式";
- this.columnHeader9.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
- //
- // columnHeader10
- //
- this.columnHeader10.Text = "设备类型";
- this.columnHeader10.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
- //
- // columnHeader16
- //
- this.columnHeader16.Text = "所属汇集";
- this.columnHeader16.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
- //
- // columnHeader17
- //
- this.columnHeader17.Text = "连接状态";
- this.columnHeader17.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
- //
// groupBox3
//
this.groupBox3.Controls.Add(this.sensor_list);
@@ -311,72 +212,6 @@
this.groupBox3.TabStop = false;
this.groupBox3.Text = "传感器信息";
//
- // sensor_list
- //
- this.sensor_list.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
- this.columnHeader11,
- this.columnHeader12,
- this.columnHeader13,
- this.columnHeader14,
- this.columnHeader15,
- this.columnHeader19,
- this.columnHeader20,
- this.columnHeader21});
- this.sensor_list.Dock = System.Windows.Forms.DockStyle.Fill;
- this.sensor_list.HideSelection = false;
- this.sensor_list.Location = new System.Drawing.Point(4, 26);
- this.sensor_list.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
- this.sensor_list.Name = "sensor_list";
- this.sensor_list.Size = new System.Drawing.Size(1417, 616);
- this.sensor_list.TabIndex = 1;
- this.sensor_list.UseCompatibleStateImageBehavior = false;
- this.sensor_list.View = System.Windows.Forms.View.Details;
- //
- // columnHeader11
- //
- this.columnHeader11.Text = "编号";
- this.columnHeader11.Width = 80;
- //
- // columnHeader12
- //
- this.columnHeader12.Text = "名称";
- this.columnHeader12.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
- this.columnHeader12.Width = 120;
- //
- // columnHeader13
- //
- this.columnHeader13.Text = "序号";
- this.columnHeader13.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
- this.columnHeader13.Width = 40;
- //
- // columnHeader14
- //
- this.columnHeader14.Text = "类型";
- this.columnHeader14.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
- //
- // columnHeader15
- //
- this.columnHeader15.Text = "设备编号";
- this.columnHeader15.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
- //
- // columnHeader19
- //
- this.columnHeader19.Text = "时间";
- this.columnHeader19.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
- this.columnHeader19.Width = 130;
- //
- // columnHeader20
- //
- this.columnHeader20.Text = "数据";
- this.columnHeader20.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
- this.columnHeader20.Width = 140;
- //
- // columnHeader21
- //
- this.columnHeader21.Text = "时间间隔(ms)";
- this.columnHeader21.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
- this.columnHeader21.Width = 100;
- //
// timer1
//
this.timer1.Enabled = true;
@@ -440,6 +275,200 @@
this.label_CollectID.TextAlign = System.Drawing.ContentAlignment.TopRight;
this.label_CollectID.Click += new System.EventHandler(this.Label_CollectID_Click);
//
+ // adapter_list
+ //
+ this.adapter_list.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
+ this.columnHeader1,
+ this.columnHeader2,
+ this.columnHeader3,
+ this.columnHeader4,
+ this.columnHeader5});
+ this.adapter_list.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.adapter_list.HideSelection = false;
+ this.adapter_list.Location = new System.Drawing.Point(4, 26);
+ this.adapter_list.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
+ this.adapter_list.Name = "adapter_list";
+ this.adapter_list.Size = new System.Drawing.Size(263, 261);
+ this.adapter_list.TabIndex = 0;
+ this.adapter_list.UseCompatibleStateImageBehavior = false;
+ this.adapter_list.View = System.Windows.Forms.View.Details;
+ //
+ // columnHeader1
+ //
+ this.columnHeader1.Text = "编号";
+ this.columnHeader1.Width = 40;
+ //
+ // columnHeader2
+ //
+ this.columnHeader2.Text = "名称";
+ this.columnHeader2.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
+ this.columnHeader2.Width = 80;
+ //
+ // columnHeader3
+ //
+ this.columnHeader3.Text = "IP地址";
+ this.columnHeader3.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
+ this.columnHeader3.Width = 100;
+ //
+ // columnHeader4
+ //
+ this.columnHeader4.Text = "端口号";
+ this.columnHeader4.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
+ //
+ // columnHeader5
+ //
+ this.columnHeader5.Text = "连接状态";
+ this.columnHeader5.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
+ this.columnHeader5.Width = 97;
+ //
+ // equip_list
+ //
+ this.equip_list.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
+ this.columnHeader6,
+ this.columnHeader7,
+ this.columnHeader8,
+ this.columnHeader9,
+ this.columnHeader10,
+ this.columnHeader16,
+ this.columnHeader17});
+ this.equip_list.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.equip_list.HideSelection = false;
+ this.equip_list.Location = new System.Drawing.Point(4, 26);
+ this.equip_list.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
+ this.equip_list.Name = "equip_list";
+ this.equip_list.Size = new System.Drawing.Size(1140, 261);
+ this.equip_list.TabIndex = 1;
+ this.equip_list.UseCompatibleStateImageBehavior = false;
+ this.equip_list.View = System.Windows.Forms.View.Details;
+ //
+ // columnHeader6
+ //
+ this.columnHeader6.Text = "编号";
+ this.columnHeader6.Width = 50;
+ //
+ // columnHeader7
+ //
+ this.columnHeader7.Text = "名称";
+ this.columnHeader7.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
+ this.columnHeader7.Width = 120;
+ //
+ // columnHeader8
+ //
+ this.columnHeader8.Text = "连接串";
+ this.columnHeader8.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
+ this.columnHeader8.Width = 120;
+ //
+ // columnHeader9
+ //
+ this.columnHeader9.Text = "连接方式";
+ this.columnHeader9.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
+ //
+ // columnHeader10
+ //
+ this.columnHeader10.Text = "设备类型";
+ this.columnHeader10.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
+ //
+ // columnHeader16
+ //
+ this.columnHeader16.Text = "所属汇集";
+ this.columnHeader16.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
+ //
+ // columnHeader17
+ //
+ this.columnHeader17.Text = "连接状态";
+ this.columnHeader17.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
+ //
+ // sensor_list
+ //
+ this.sensor_list.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
+ this.columnHeader11,
+ this.columnHeader12,
+ this.columnHeader13,
+ this.columnHeader14,
+ this.columnHeader15,
+ this.columnHeader19,
+ this.columnHeader20,
+ this.columnHeader21});
+ this.sensor_list.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.sensor_list.FullRowSelect = true;
+ this.sensor_list.HideSelection = false;
+ this.sensor_list.Location = new System.Drawing.Point(4, 26);
+ this.sensor_list.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
+ this.sensor_list.Name = "sensor_list";
+ this.sensor_list.Size = new System.Drawing.Size(1417, 616);
+ this.sensor_list.TabIndex = 1;
+ this.sensor_list.UseCompatibleStateImageBehavior = false;
+ this.sensor_list.View = System.Windows.Forms.View.Details;
+ this.sensor_list.MouseClick += new System.Windows.Forms.MouseEventHandler(this.sensor_list_MouseClick);
+ //
+ // columnHeader11
+ //
+ this.columnHeader11.Text = "编号";
+ this.columnHeader11.Width = 80;
+ //
+ // columnHeader12
+ //
+ this.columnHeader12.Text = "名称";
+ this.columnHeader12.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
+ this.columnHeader12.Width = 120;
+ //
+ // columnHeader13
+ //
+ this.columnHeader13.Text = "序号";
+ this.columnHeader13.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
+ this.columnHeader13.Width = 40;
+ //
+ // columnHeader14
+ //
+ this.columnHeader14.Text = "类型";
+ this.columnHeader14.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
+ //
+ // columnHeader15
+ //
+ this.columnHeader15.Text = "设备编号";
+ this.columnHeader15.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
+ //
+ // columnHeader19
+ //
+ this.columnHeader19.Text = "时间";
+ this.columnHeader19.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
+ this.columnHeader19.Width = 130;
+ //
+ // columnHeader20
+ //
+ this.columnHeader20.Text = "数据";
+ this.columnHeader20.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
+ this.columnHeader20.Width = 140;
+ //
+ // columnHeader21
+ //
+ this.columnHeader21.Text = "时间间隔(ms)";
+ this.columnHeader21.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
+ this.columnHeader21.Width = 100;
+ //
+ // contextMenuStrip2
+ //
+ this.contextMenuStrip2.ImageScalingSize = new System.Drawing.Size(20, 20);
+ this.contextMenuStrip2.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.toolStripMenuItem1,
+ this.toolStripMenuItem2});
+ this.contextMenuStrip2.Name = "contextMenuStrip1";
+ this.contextMenuStrip2.Size = new System.Drawing.Size(241, 97);
+ //
+ // toolStripMenuItem1
+ //
+ this.toolStripMenuItem1.Name = "toolStripMenuItem1";
+ this.toolStripMenuItem1.Size = new System.Drawing.Size(240, 30);
+ this.toolStripMenuItem1.Text = "修改";
+ this.toolStripMenuItem1.Click += new System.EventHandler(this.toolStripMenuItem1_Click);
+ //
+ // toolStripMenuItem2
+ //
+ this.toolStripMenuItem2.Name = "toolStripMenuItem2";
+ this.toolStripMenuItem2.Size = new System.Drawing.Size(240, 30);
+ this.toolStripMenuItem2.Text = "读取";
+ this.toolStripMenuItem2.Click += new System.EventHandler(this.toolStripMenuItem2_Click);
+ //
// FrmDisplayView
//
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
@@ -473,6 +502,7 @@
this.groupBox2.ResumeLayout(false);
this.groupBox3.ResumeLayout(false);
this.contextMenuStrip1.ResumeLayout(false);
+ this.contextMenuStrip2.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
@@ -519,6 +549,9 @@
private System.Windows.Forms.ColumnHeader columnHeader16;
private System.Windows.Forms.ColumnHeader columnHeader17;
private System.Windows.Forms.ToolStripMenuItem v20230913ToolStripMenuItem;
+ private System.Windows.Forms.ContextMenuStrip contextMenuStrip2;
+ private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1;
+ private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem2;
}
}
diff --git a/HighWayAssemble/FrmDisplayView.cs b/HighWayAssemble/FrmDisplayView.cs
index bdf66bc..dc6b7f8 100644
--- a/HighWayAssemble/FrmDisplayView.cs
+++ b/HighWayAssemble/FrmDisplayView.cs
@@ -1,4 +1,5 @@
using Highway.Assemble.common;
+using HighWayAssemble.Main;
using System;
using System.Collections.Generic;
using System.Diagnostics;
@@ -17,6 +18,7 @@ namespace HighWayAssemble
public FrmDisplayView()
{
InitializeComponent();
+ this.StartPosition = FormStartPosition.CenterScreen;
controller = new FrmDisplayControl(this);
}
@@ -426,5 +428,56 @@ namespace HighWayAssemble
}
}
+ private void sensor_list_MouseClick(object sender, MouseEventArgs e)
+ {
+ if (e.Button != MouseButtons.Right) return;
+ // 获取点击的列表项
+ var hitTestInfo = sensor_list.HitTest(e.X, e.Y);
+ if (hitTestInfo.Item == null) return; // 点击空白处不触发
+ // 选中点击项(可选)
+ hitTestInfo.Item.Selected = true;
+ // 显示上下文菜单
+ contextMenuStrip2.Show(sensor_list, e.Location);
+
+ }
+ ///
+ /// 修改功率设置
+ ///
+ ///
+ ///
+ private void toolStripMenuItem1_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ WriteData writeData = new WriteData(controller, sensor_list.SelectedItems[0].Text.ToString());
+ writeData.StartPosition = FormStartPosition.Manual;
+ int x = this.Left + (this.Width - writeData.Width) / 2;
+ int y = this.Top + (this.Height - writeData.Height) / 2;
+
+ // 设置子窗口位置
+ writeData.Location = new Point(x, y);
+ writeData.Show(this); // 关联父窗口(可选,视需求)
+ }
+ catch (Exception ex)
+ {
+
+ }
+ }
+ ///
+ /// 测试读取
+ ///
+ ///
+ ///
+ private void toolStripMenuItem2_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ controller.ReadEPC(sensor_list.SelectedItems[0].Text.ToString());
+ }
+ catch (Exception ex)
+ {
+
+ }
+ }
}
}
diff --git a/HighWayAssemble/FrmDisplayView.resx b/HighWayAssemble/FrmDisplayView.resx
index 2fa2856..8060261 100644
--- a/HighWayAssemble/FrmDisplayView.resx
+++ b/HighWayAssemble/FrmDisplayView.resx
@@ -1262,6 +1262,9 @@
//////////////////////////////////8=
+
+ 556, 16
+
AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
diff --git a/HighWayAssemble/HighWayAssemble.csproj b/HighWayAssemble/HighWayAssemble.csproj
index 167ef6d..68388f0 100644
--- a/HighWayAssemble/HighWayAssemble.csproj
+++ b/HighWayAssemble/HighWayAssemble.csproj
@@ -124,11 +124,11 @@
-
- ..\packages\TouchSocket.3.1.4\lib\net45\TouchSocket.dll
+
+ ..\packages\TouchSocket.3.1.18\lib\net45\TouchSocket.dll
-
- ..\packages\TouchSocket.Core.3.1.4\lib\net45\TouchSocket.Core.dll
+
+ ..\packages\TouchSocket.Core.3.1.18\lib\net45\TouchSocket.Core.dll
..\packages\TouchSocket.Http.3.1.4\lib\net45\TouchSocket.Http.dll
@@ -154,6 +154,12 @@
+
+ Form
+
+
+ WriteData.cs
+
@@ -168,6 +174,9 @@
FrmDisplayView.cs
+
+ WriteData.cs
+
ResXFileCodeGenerator
Resources.Designer.cs
@@ -234,7 +243,7 @@
-
+
diff --git a/HighWayAssemble/Main/FrmDisplayControl.cs b/HighWayAssemble/Main/FrmDisplayControl.cs
index f6eb447..4ffc1a5 100644
--- a/HighWayAssemble/Main/FrmDisplayControl.cs
+++ b/HighWayAssemble/Main/FrmDisplayControl.cs
@@ -12,6 +12,7 @@ namespace HighWayAssemble
{
FrmDisplayView view;
ISoftInfo m_softInfo;
+ FrmDisplayModel frmDisplayModel;
///
/// 注册视图层插件
///
@@ -21,7 +22,7 @@ namespace HighWayAssemble
this.view = view;
OnRegister();//绑定
/* m_model =*/
- new FrmDisplayModel();
+ frmDisplayModel = new FrmDisplayModel();
// m_ConfigInfo = App.Make();
m_softInfo = App.Make();
@@ -189,5 +190,17 @@ namespace HighWayAssemble
//});
App.On(EventSystem.LoadCollectID, LoadCollectID);
}
+ public void ReadEPC(string CombineID)
+ {
+ frmDisplayModel.ReadEPC(CombineID);
+ }
+ public int GetRf(string CombineID)
+ {
+ return frmDisplayModel.GetRf(CombineID);
+ }
+ public void SetRf(string CombineID,int idb)
+ {
+ frmDisplayModel.SetRf(CombineID, idb * 100);
+ }
}
}
diff --git a/HighWayAssemble/Main/FrmDisplayModel.cs b/HighWayAssemble/Main/FrmDisplayModel.cs
index 298b60f..886281c 100644
--- a/HighWayAssemble/Main/FrmDisplayModel.cs
+++ b/HighWayAssemble/Main/FrmDisplayModel.cs
@@ -66,6 +66,7 @@ namespace HighWayAssemble
{
try
{
+ FrmDisplayView.LogInfo.Info("创建SockteSvr成功!");
SoftInfo = App.Make();
SoftInfo.CollectInfo = new Collect();
// configInfo = App.Make();
@@ -80,7 +81,7 @@ namespace HighWayAssemble
var t = Task.Run(async delegate
{
await Task.Delay(10);
- CreateTcp();
+ //CreateTcp();
MesHttpClient = new MesHttpClient();
MesHttpClient.init();
var service = new HttpService();
@@ -117,8 +118,21 @@ namespace HighWayAssemble
a.UseDefaultHttpServicePlugin();
}
));
- await service.StartAsync();
- await m_service.StartAsync();//启动
+
+ try
+ {
+ await service.StartAsync();
+ //await m_service.StartAsync();//启动
+ FrmDisplayView.LogInfo.Info("创建SockteSvr成功!");
+ }
+ catch (Exception ex)
+ {
+ FrmDisplayView.LogInfo.Fatal("读取配置文件异常!空间名:" + ex.Source + ";" + '\n' +
+ "方法名:" + ex.TargetSite + '\n' +
+ "故障点:" + ex.StackTrace.Substring(ex.StackTrace.LastIndexOf("\\") + 1, ex.StackTrace.Length - ex.StackTrace.LastIndexOf("\\") - 1) + '\n' +
+ "错误提示:" + ex.Message);
+ }
+
//CreatSocketServer();
@@ -152,7 +166,10 @@ namespace HighWayAssemble
}
catch (Exception ex)
{
-
+ FrmDisplayView.LogInfo.Fatal("读取配置文件异常!空间名:" + ex.Source + ";" + '\n' +
+ "方法名:" + ex.TargetSite + '\n' +
+ "故障点:" + ex.StackTrace.Substring(ex.StackTrace.LastIndexOf("\\") + 1, ex.StackTrace.Length - ex.StackTrace.LastIndexOf("\\") - 1) + '\n' +
+ "错误提示:" + ex.Message);
}
}
@@ -332,8 +349,7 @@ namespace HighWayAssemble
m_EquipClient.RecEquipStateasyc(async (state) =>
{
App.TriggerHalt(EventSystem.updateEquipListInfoasyc, state);
-
-
+ await InsertDeviceState(state.m_iDeviceId, state.m_ConnectState);
});
//设备状态回调
m_EquipClient.RecEquipState(async (state) =>
@@ -1557,5 +1573,43 @@ namespace HighWayAssemble
}
}
+
+ public void ReadEPC(string CombineID)
+ {
+ try
+ {
+ List rfid = m_EquipClient.ReadRFID(CombineID);
+ }
+ catch (Exception ex)
+ {
+
+ throw;
+ }
+ }
+ public int GetRf(string CombineID)
+ {
+ int flag = 0;
+ try
+ {
+ flag = m_EquipClient.GetRf(CombineID);
+ return flag;
+ }
+ catch (Exception ex)
+ {
+ return flag;
+ }
+ }
+ public void SetRf(string CombineID,int db)
+ {
+ bool iflag = false;
+ try
+ {
+ iflag = m_EquipClient.SetRf(CombineID, db);
+ }
+ catch (Exception ex)
+ {
+
+ }
+ }
}
}
diff --git a/HighWayAssemble/Main/WriteData.Designer.cs b/HighWayAssemble/Main/WriteData.Designer.cs
new file mode 100644
index 0000000..201f94b
--- /dev/null
+++ b/HighWayAssemble/Main/WriteData.Designer.cs
@@ -0,0 +1,100 @@
+namespace HighWayAssemble.Main
+{
+ partial class WriteData
+ {
+ ///
+ /// 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.textBox1 = new System.Windows.Forms.TextBox();
+ this.read = new System.Windows.Forms.Button();
+ this.write = new System.Windows.Forms.Button();
+ this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
+ ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
+ this.SuspendLayout();
+ //
+ // textBox1
+ //
+ this.textBox1.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ this.textBox1.Location = new System.Drawing.Point(164, 74);
+ this.textBox1.Name = "textBox1";
+ this.textBox1.ReadOnly = true;
+ this.textBox1.Size = new System.Drawing.Size(100, 39);
+ this.textBox1.TabIndex = 0;
+ //
+ // read
+ //
+ this.read.Location = new System.Drawing.Point(328, 74);
+ this.read.Name = "read";
+ this.read.Size = new System.Drawing.Size(108, 40);
+ this.read.TabIndex = 2;
+ this.read.Text = "读取";
+ this.read.UseVisualStyleBackColor = true;
+ this.read.Click += new System.EventHandler(this.read_Click);
+ //
+ // write
+ //
+ this.write.Location = new System.Drawing.Point(328, 152);
+ this.write.Name = "write";
+ this.write.Size = new System.Drawing.Size(108, 40);
+ this.write.TabIndex = 3;
+ this.write.Text = "写入";
+ this.write.UseVisualStyleBackColor = true;
+ this.write.Click += new System.EventHandler(this.write_Click);
+ //
+ // numericUpDown1
+ //
+ this.numericUpDown1.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ this.numericUpDown1.Location = new System.Drawing.Point(164, 152);
+ this.numericUpDown1.Name = "numericUpDown1";
+ this.numericUpDown1.Size = new System.Drawing.Size(100, 39);
+ this.numericUpDown1.TabIndex = 4;
+ //
+ // WriteData
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(602, 296);
+ this.Controls.Add(this.numericUpDown1);
+ this.Controls.Add(this.write);
+ this.Controls.Add(this.read);
+ this.Controls.Add(this.textBox1);
+ this.Name = "WriteData";
+ this.Text = "功率设置";
+ this.Load += new System.EventHandler(this.WriteData_Load);
+ ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.TextBox textBox1;
+ private System.Windows.Forms.Button read;
+ private System.Windows.Forms.Button write;
+ private System.Windows.Forms.NumericUpDown numericUpDown1;
+ }
+}
\ No newline at end of file
diff --git a/HighWayAssemble/Main/WriteData.cs b/HighWayAssemble/Main/WriteData.cs
new file mode 100644
index 0000000..87b007a
--- /dev/null
+++ b/HighWayAssemble/Main/WriteData.cs
@@ -0,0 +1,58 @@
+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 HighWayAssemble.Main
+{
+ public partial class WriteData : Form
+ {
+ public string Combineid = "";
+ FrmDisplayControl _controller;
+ public WriteData(FrmDisplayControl controller, string combineid)
+ {
+ InitializeComponent();
+ _controller = controller;
+ Combineid = combineid;
+ }
+
+ private void WriteData_Load(object sender, EventArgs e)
+ {
+ textBox1.ReadOnly = true;
+ textBox1.Enabled = false;
+ SetRf();
+ }
+
+ private void read_Click(object sender, EventArgs e)
+ {
+ SetRf();
+ }
+ ///
+ /// 设置功率
+ ///
+ private void SetRf()
+ {
+ try
+ {
+ int idb = _controller.GetRf(Combineid);
+ textBox1.Text = idb.ToString();
+ numericUpDown1.Value = idb;
+ }
+ catch (Exception ex)
+ {
+
+ }
+ }
+ private void write_Click(object sender, EventArgs e)
+ {
+ _controller.SetRf(Combineid, int.Parse(numericUpDown1.Text));
+ SetRf();
+
+ }
+ }
+}
diff --git a/HighWayAssemble/Main/WriteData.resx b/HighWayAssemble/Main/WriteData.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/HighWayAssemble/Main/WriteData.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
diff --git a/HighWayAssemble/Protocol/ApiServer.cs b/HighWayAssemble/Protocol/ApiServer.cs
index f7bb3a3..113fe44 100644
--- a/HighWayAssemble/Protocol/ApiServer.cs
+++ b/HighWayAssemble/Protocol/ApiServer.cs
@@ -87,7 +87,8 @@ namespace HighWayAssemble.Protocol
{
if (rfid != null && rfid.Any())
{
- mesReadRespon.EPCID = string.Join(",", rfid.Select(item => item.EPCstring));
+ //mesReadRespon.EPCID = string.Join(",", rfid.Select(item => item.EPCstring));
+ mesReadRespon.EPCID = "MORE";
Msg = "multiple EPC";
}
}
diff --git a/HighWayAssemble/packages.config b/HighWayAssemble/packages.config
index 4fb9f92..9e15af1 100644
--- a/HighWayAssemble/packages.config
+++ b/HighWayAssemble/packages.config
@@ -10,8 +10,8 @@
-
-
+
+
diff --git a/Highway.Assemble.EquipClient/EquipClient.cs b/Highway.Assemble.EquipClient/EquipClient.cs
index ae9db79..00cccb4 100644
--- a/Highway.Assemble.EquipClient/EquipClient.cs
+++ b/Highway.Assemble.EquipClient/EquipClient.cs
@@ -1,4 +1,5 @@
-using Highway.Assemble.common;
+using CatLib;
+using Highway.Assemble.common;
using log4net;
using Mesnac.DeviceAdapter;
using Mesnac.DeviceAdapterNet;
@@ -290,23 +291,20 @@ namespace Highway.Assemble.EquipClient
{
item.m_ConnectState = 0;
return;
- }
- if (item.m_iDeviceId == 10001)
- {
-
}
switch (item.m_ConnectState)
{
case 0: // 未连接状态
if (await RunOnThreadPool(() => pDeviceAdapter.Device_Init_Id((CommType)item.m_iConnectMode, item.m_strConnectStr, item.m_iDeviceId)))
- {
+ {
if (await RunOnThreadPool(() => pDeviceAdapter.Device_Connect()))
{
// 管理事件订阅,避免重复订阅
pDeviceAdapter.RecvIdentifyDataEvent -= RecvIdentifyData_Instance;
pDeviceAdapter.RecvIdentifyDataEvent += RecvIdentifyData_Instance;
- item.m_ConnectState = await GetConnectionStateFromHeartbeat(pDeviceAdapter);
+ //item.m_ConnectState = await GetConnectionStateFromHeartbeat(pDeviceAdapter);
+ item.m_ConnectState = pDeviceAdapter.GetOnlineStatus()==true?(byte)1:(byte)0;
}
else
{
@@ -320,26 +318,27 @@ namespace Highway.Assemble.EquipClient
break;
case 1: // 已连接状态
- item.m_ConnectState = await GetConnectionStateFromHeartbeat(pDeviceAdapter);
+ //item.m_ConnectState = await GetConnectionStateFromHeartbeat(pDeviceAdapter);
+ item.m_ConnectState = pDeviceAdapter.GetOnlineStatus() == true ? (byte)1 : (byte)0;
break;
- case 2: // 连接异常状态
- int heartbeatResult = await GetConnectionStateFromHeartbeat(pDeviceAdapter);
- if (heartbeatResult == 2)
- {
- item.m_ConnectState = 0;
- await RunOnThreadPool(() => item.m_IDeviceAdapter.Device_Destroy());
- }
- else if (heartbeatResult == 1)
- {
- item.m_ConnectState = 1;
- }
- else
- {
- item.m_ConnectState = 0;
- await RunOnThreadPool(() => item.m_IDeviceAdapter.Device_Destroy());
- }
- break;
+ //case 2: // 连接异常状态
+ // int heartbeatResult = await GetConnectionStateFromHeartbeat(pDeviceAdapter);
+ // if (heartbeatResult == 2)
+ // {
+ // item.m_ConnectState = 0;
+ // await RunOnThreadPool(() => item.m_IDeviceAdapter.Device_Destroy());
+ // }
+ // else if (heartbeatResult == 1)
+ // {
+ // item.m_ConnectState = 1;
+ // }
+ // else
+ // {
+ // item.m_ConnectState = 0;
+ // await RunOnThreadPool(() => item.m_IDeviceAdapter.Device_Destroy());
+ // }
+ // break;
}
}
@@ -852,7 +851,7 @@ namespace Highway.Assemble.EquipClient
//LogInfo.Info("合并编号:" + id + ",识别单次标签命令自报");
FilterData = m_SensorInfoList.Find(x=>x.combineid == id).FilterData;
tags = GetOneEpcByCombineId(id);
- if (tags != null)
+ if (tags != null && tags.Count > 0)
{
//有过滤
LogInfo.Info("-------------------------------------------------------------------------------------------------------------");
@@ -1265,6 +1264,52 @@ namespace Highway.Assemble.EquipClient
}
}
+
+ public bool SetRf(string id,int idb)
+ {
+ bool flag = false;
+ try
+ {
+ DeviceInfo deviceInfo = null;
+ deviceInfo = GetIDeviceInfoByCombineId(id.ToString());
+ if (deviceInfo.m_IDeviceAdapter != null)
+ {
+ if (deviceInfo.m_IDeviceAdapter.GetOnlineStatus())
+ {
+ flag = deviceInfo.m_IDeviceAdapter.Device_SetRf(idb, 1, WriteOrRead.Write);
+ }
+ return flag;
+ }
+ return flag;
+ }
+ catch (Exception ex)
+ {
+ return false;
+ }
+ }
+
+ public int GetRf(string id)
+ {
+ int flag = 0;
+ try
+ {
+ DeviceInfo deviceInfo = null;
+ deviceInfo = GetIDeviceInfoByCombineId(id.ToString());
+ if (deviceInfo.m_IDeviceAdapter != null)
+ {
+ if (deviceInfo.m_IDeviceAdapter.GetOnlineStatus())
+ {
+ flag = deviceInfo.m_IDeviceAdapter.Device_GetRf(1, WriteOrRead.Read);
+ }
+ return flag;
+ }
+ return flag;
+ }
+ catch (Exception ex)
+ {
+ return flag;
+ }
+ }
}
}
diff --git a/Highway.Assemble.EquipClient/Highway.Assemble.EquipClient.csproj b/Highway.Assemble.EquipClient/Highway.Assemble.EquipClient.csproj
index 13be077..339db75 100644
--- a/Highway.Assemble.EquipClient/Highway.Assemble.EquipClient.csproj
+++ b/Highway.Assemble.EquipClient/Highway.Assemble.EquipClient.csproj
@@ -69,5 +69,8 @@
Mesnac.DeviceAdapter.RFly_I160
+
+
+
\ No newline at end of file
diff --git a/Highway.Assemble.EquipClient/IEquipClient.cs b/Highway.Assemble.EquipClient/IEquipClient.cs
index 753ddae..c9fd3a7 100644
--- a/Highway.Assemble.EquipClient/IEquipClient.cs
+++ b/Highway.Assemble.EquipClient/IEquipClient.cs
@@ -21,6 +21,10 @@ namespace Highway.Assemble.EquipClient
List ReadRFID(string id);
+ bool SetRf(string id,int iDB);
+
+ int GetRf(string id);
+
void RecSendData(Action> action);
void RecAutoData(Action action);
diff --git a/Highway.Assemble.EquipClient/app.config b/Highway.Assemble.EquipClient/app.config
new file mode 100644
index 0000000..a0cefc2
--- /dev/null
+++ b/Highway.Assemble.EquipClient/app.config
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Mesnac.DeviceAdapter.Fuchs/FuchsDevice.cs b/Mesnac.DeviceAdapter.Fuchs/FuchsDevice.cs
index ca33439..2fbac3f 100644
--- a/Mesnac.DeviceAdapter.Fuchs/FuchsDevice.cs
+++ b/Mesnac.DeviceAdapter.Fuchs/FuchsDevice.cs
@@ -1514,6 +1514,16 @@ namespace Mesnac.DeviceAdapter.Fuchs
throw new NotImplementedException();
}
+ public bool GetOnlineStatus()
+ {
+ throw new NotImplementedException();
+ }
+
+ public int Device_GetRf(byte Antenna, WriteOrRead RorW)
+ {
+ throw new NotImplementedException();
+ }
+
//public List TagInventoryTimePeriod(byte Antenna, int time)
//{
// List t = new List { };
diff --git a/Mesnac.DeviceAdapter.HWKC_81600/HWKC_81600Device.cs b/Mesnac.DeviceAdapter.HWKC_81600/HWKC_81600Device.cs
index 352a232..8183af6 100644
--- a/Mesnac.DeviceAdapter.HWKC_81600/HWKC_81600Device.cs
+++ b/Mesnac.DeviceAdapter.HWKC_81600/HWKC_81600Device.cs
@@ -790,6 +790,16 @@ namespace Mesnac.DeviceAdapter.HWKC_81600
{
throw new NotImplementedException();
}
+
+ public bool GetOnlineStatus()
+ {
+ throw new NotImplementedException();
+ }
+
+ public int Device_GetRf(byte Antenna, WriteOrRead RorW)
+ {
+ throw new NotImplementedException();
+ }
#endregion
}
}
diff --git a/Mesnac.DeviceAdapter.RFly_I160/Mesnac.DeviceAdapter.RFly_I160.csproj b/Mesnac.DeviceAdapter.RFly_I160/Mesnac.DeviceAdapter.RFly_I160.csproj
index c996a40..285ff17 100644
--- a/Mesnac.DeviceAdapter.RFly_I160/Mesnac.DeviceAdapter.RFly_I160.csproj
+++ b/Mesnac.DeviceAdapter.RFly_I160/Mesnac.DeviceAdapter.RFly_I160.csproj
@@ -37,13 +37,41 @@
False
..\dll\log4net.dll
+
+ ..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll
+
+
+ ..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll
+
+
+ ..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll
+
+
+
+ ..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll
+
+
+ ..\packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll
+
+
+ ..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll
+
+
+ ..\packages\System.ValueTuple.4.5.0\lib\net461\System.ValueTuple.dll
+
+
+ ..\packages\TouchSocket.3.1.18\lib\net45\TouchSocket.dll
+
+
+ ..\packages\TouchSocket.Core.3.1.18\lib\net45\TouchSocket.Core.dll
+
@@ -59,6 +87,12 @@
Mesnac.IDeviceAdapter
+
+
+
+
+
+
" 01 01"
+ {
+ string returnStr = "";
+ if (bytes != null)
+ {
+ for (int i = 0; i < iLen; i++)
+ {
+ returnStr += bytes[i].ToString("X2");
+ }
+ }
+ return returnStr;
+ }
+ public byte[] PareReceiveData(byte[] buffer, int iLen)
+ {
+ RecvState enumRecvState = RecvState.WaitingBeginChar1_State;
+ byte[] m_szFullMessage = new byte[buffer.Length]; //此数组用于状态机
+ int m_iPosition = 0;
+ byte m_iVerify = 0;
+ int iBarcodeLength = 0;//条码长度
+ ArrayList m_FrecvData = new ArrayList();
+ //m_RFly_I160Adapter.LogInfo.Warn("RFly-I160进入状态机:");
+ try
+ {
+ for (int i = 0; i < iLen; i++)
+ {
+ switch (enumRecvState)
+ {
+ case RecvState.WaitingBeginChar1_State: //开始接受数据帧1 0xBB
+ //m_RFly_I160Adapter.LogInfo.Warn("RFly-I160等待接收帧同步字符WaitingBeginChar1_State:0XBB");
+ Array.Clear(m_szFullMessage, 0, buffer.Length);//清空为0
+ if (buffer[i] == 0xBB)
+ {
+ //m_RFly_I160Adapter.LogInfo.Warn("Buffer数据为: " + StringChange.bytesToHexStr(buffer, buffer.Length));
+ m_szFullMessage[m_iPosition] = buffer[i];
+ m_iPosition++;
+ enumRecvState = RecvState.WaitingBeginChar2_State;
+ }
+ else
+ {
+ m_iPosition = 0;
+ enumRecvState = RecvState.WaitingBeginChar1_State;
+ }
+ break;
+ case RecvState.WaitingBeginChar2_State: //开始接受数据帧1 0xDD
+ //m_RFly_I160Adapter.LogInfo.Warn("RFly-I160等待接收帧同步字符WaitingBeginChar2_State:0XDD");
+ if (buffer[i] == 0xDD)
+ {
+ m_szFullMessage[m_iPosition] = buffer[i];
+ m_iPosition++;
+ enumRecvState = RecvState.WaitingForBarcodeLength_State;
+ }
+ else
+ {
+ m_iPosition = 0;
+ enumRecvState = RecvState.WaitingBeginChar1_State;
+ }
+ break;
+ case RecvState.WaitingForBarcodeLength_State: //开始接受数据长度(TagCount - EPC)
+ m_szFullMessage[m_iPosition] = buffer[i];
+ iBarcodeLength = buffer[i]; //单组标签:18;两组标签:35
+ m_iPosition++;
+ enumRecvState = RecvState.WaitingForCode_State;
+ break;
+
+ case RecvState.WaitingForCode_State: //开始接受指令编号
+ if (buffer[i] == 0x02)
+ {
+ m_szFullMessage[m_iPosition] = buffer[i];
+ m_iPosition++;
+ enumRecvState = RecvState.WaitingForStus_State;
+ }
+ else if (buffer[i] == 0x90) // 如果是心跳BB DD 01 90 00 1F 8E 0D
+ {
+ //m_RFly_I160Adapter.LogInfo.Warn("RFly-I160等待接受WaitingForEndChar_State:温度");
+ m_szFullMessage[m_iPosition] = buffer[i];
+ m_iPosition++;
+ enumRecvState = RecvState.WaitingForEndChar_State;
+ }
+ else if (buffer[i] == 0xBF) // 如果是心跳BB DD 04 BF 00 00 00 F9 0B 49 0D
+ {
+ //m_RFly_I160Adapter.LogInfo.Warn("RFly-I160等待接受WaitingForEndChar_State:心跳");
+ m_szFullMessage[m_iPosition] = buffer[i];
+ m_iPosition++;
+ enumRecvState = RecvState.WaitingForEndChar_State;
+ }
+ else if (buffer[i] == 0x51)
+ {
+ m_szFullMessage[m_iPosition] = buffer[i];
+ m_iPosition++;
+ enumRecvState = RecvState.WaitingForStus_State;
+ }
+ else
+ {
+ m_iPosition = 0;
+ enumRecvState = RecvState.WaitingBeginChar1_State;
+ }
+ break;
+ case RecvState.WaitingForStus_State: //开始接受状态码
+ if (buffer[i] == 0x00)
+ {
+ m_szFullMessage[m_iPosition] = buffer[i];
+ m_iPosition++;
+ enumRecvState = RecvState.WaitingForTagCount_State;
+ }
+ else if (buffer[i] == 0x40)
+ {
+ m_szFullMessage[m_iPosition] = buffer[i];
+ //m_RFly_I160Adapter.LogInfo.Warn("RFU620等待接受WaitingForEndChar_State:Noread");
+ lock (m_FrecvData)
+ {
+ m_FrecvData.Add(m_szFullMessage);
+ }
+
+ m_iPosition = 0;
+ i = iLen;
+ enumRecvState = RecvState.WaitingBeginChar1_State;
+ //m_RFly_I160Adapter.LogInfo.Warn("RFly-I160状态机结束。");
+ }
+ break;
+ case RecvState.WaitingForTagCount_State: //开始接受标签组数
+ Array.Copy(buffer, i, m_szFullMessage, m_iPosition, iBarcodeLength);//m_iPosition = 5
+ byte[] tempData = new byte[iBarcodeLength];
+ Array.Clear(tempData, 0, iBarcodeLength);
+ Array.Copy(buffer, i, tempData, 0, iBarcodeLength);
+ //m_RFly_I160Adapter.LogInfo.Warn("解析的数据为: " + StringChange.bytesToHexStr(tempData, iBarcodeLength));
+
+ //m_szFullMessage[m_iPosition] = buffer[i]; //单组标签:01;两组标签:02
+ m_iPosition = m_iPosition + iBarcodeLength; //m_iPosition = 39
+ i = i + iBarcodeLength - 1; //i = 39
+ enumRecvState = RecvState.WaitingForXor_State;
+ break;
+ case RecvState.WaitingForXor_State: //开始比对校验位 Rfly160
+ byte[] m_CRCVerify = new byte[1024]; //此数组用于校验位计算
+ Array.Clear(m_CRCVerify, 0, m_CRCVerify.Length);
+ Array.Copy(m_szFullMessage, 2, m_CRCVerify, 0, iBarcodeLength + 3); //校验位计算是从Length - EPC 结束
+ m_szFullMessage[m_iPosition] = buffer[i];
+ m_iVerify = m_szFullMessage[m_iPosition];
+ if (m_iVerify == CalculateVerify(m_CRCVerify, m_CRCVerify.Length))
+ {
+ m_iPosition++;
+ enumRecvState = RecvState.WaitingForEndChar_State;
+ }
+ else //如果校验不成功
+ {
+ m_iPosition = 0;
+ enumRecvState = RecvState.WaitingBeginChar1_State;
+ }
+ break;
+ case RecvState.WaitingForEndChar_State:
+ if (buffer[0] == 0xBB && buffer[1] == 0xDD && buffer[2] == 0x00) //此处为Noread数据显示
+ {
+ //m_RFly_I160Adapter.LogInfo.Warn("RFly-I160等待接受WaitingForEndChar_State:Noread");
+ m_szFullMessage[0] = 0xBB;
+ m_szFullMessage[1] = 0xDD;
+ m_szFullMessage[2] = 0x00;
+ lock (m_FrecvData)
+ {
+ m_FrecvData.Add(m_szFullMessage);
+ }
+
+ m_iPosition = 0;
+ i = iLen;
+ enumRecvState = RecvState.WaitingBeginChar1_State;
+ }
+ else if (buffer[i] == 0x00) //获取温度
+ {
+ m_szFullMessage[3] = 0x00;
+ m_iPosition++;
+ lock (m_FrecvData)
+ {
+ m_FrecvData.Add(m_szFullMessage);
+ }
+
+ }
+ else if (buffer[0] == 0xBB && buffer[1] == 0xDD && buffer[2] == 0x04 && buffer[3] == 0xBF)
+ {
+ m_szFullMessage[3] = 0xBF;
+ m_iPosition++;
+ lock (m_FrecvData)
+ {
+ m_FrecvData.Add(m_szFullMessage);
+ }
+
+ }
+ else
+ {
+ m_szFullMessage[m_iPosition] = buffer[i];
+ m_iPosition++;
+ if (buffer[i] == 0x0D)
+ {
+ //m_RFly_I160Adapter.LogInfo.Warn("RFly-I160准备发送");
+ lock (m_FrecvData)
+ {
+ m_FrecvData.Add(m_szFullMessage);
+ }
+
+ }
+ }
+ m_iPosition = 0;
+ enumRecvState = RecvState.WaitingBeginChar1_State;
+ //m_RFly_I160Adapter.LogInfo.Warn("RFly-I160状态机结束。");
+ break;
+ }
+ }
+ return m_szFullMessage;
+ }
+ catch (Exception ex)
+ {
+ LogInfo.Error(ex.Message);
+ return null;
+ }
+
+ }
+
+ public byte CalculateVerify(byte[] pMessage, int iLength)
+ {
+ UInt16 i;
+ byte iVerify = 0;
+
+ iVerify = pMessage[0];
+ for (i = 1; i < iLength; i++)
+ {
+ iVerify = (byte)(iVerify ^ pMessage[i]);
+ }
+ return iVerify;
+ }
#endregion
}
}
diff --git a/Mesnac.DeviceAdapter.RFly_I160/StringChange.cs b/Mesnac.DeviceAdapter.RFly_I160/StringChange.cs
index a9af65c..5283765 100644
--- a/Mesnac.DeviceAdapter.RFly_I160/StringChange.cs
+++ b/Mesnac.DeviceAdapter.RFly_I160/StringChange.cs
@@ -230,6 +230,7 @@ namespace Mesnac.DeviceAdapter.RFly_I160
}
return iNegate;
}
+
}
}
diff --git a/Mesnac.DeviceAdapter.RFly_I160/packages.config b/Mesnac.DeviceAdapter.RFly_I160/packages.config
new file mode 100644
index 0000000..de7f705
--- /dev/null
+++ b/Mesnac.DeviceAdapter.RFly_I160/packages.config
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file