diff --git a/LFP_Manager/Controls/ucCalibration.Designer.cs b/LFP_Manager/Controls/ucCalibration.Designer.cs
index 95e9f56..ec21a66 100644
--- a/LFP_Manager/Controls/ucCalibration.Designer.cs
+++ b/LFP_Manager/Controls/ucCalibration.Designer.cs
@@ -1,4 +1,4 @@
-namespace LFP_Manager.Controls
+namespace LFP_Manager.Controls
{
partial class ucCalibration
{
@@ -29,10 +29,19 @@
private void InitializeComponent()
{
this.layoutControl1 = new DevExpress.XtraLayout.LayoutControl();
+ this.gbAntiTheft = new DevExpress.XtraEditors.GroupControl();
+ this.layoutControl4 = new DevExpress.XtraLayout.LayoutControl();
this.TeSensitive = new DevExpress.XtraEditors.TextEdit();
- this.BtnAntiTheftEnable = new DevExpress.XtraEditors.SimpleButton();
- this.BtnClearAntiTheftProtect = new DevExpress.XtraEditors.SimpleButton();
- this.BtnAntiTheftDisable = new DevExpress.XtraEditors.SimpleButton();
+ this.TeAntiTheftGyroCurr = new DevExpress.XtraEditors.TextEdit();
+ this.BtnClearAlarm = new DevExpress.XtraEditors.SimpleButton();
+ this.layoutControlItemClearAlarm = new DevExpress.XtraLayout.LayoutControlItem();
+ this.BtnClearActivation = new DevExpress.XtraEditors.SimpleButton();
+ this.layoutControlGroup4 = new DevExpress.XtraLayout.LayoutControlGroup();
+ this.layoutControlItem16 = new DevExpress.XtraLayout.LayoutControlItem();
+ this.layoutControlItem17 = new DevExpress.XtraLayout.LayoutControlItem();
+ this.simpleLabelItemAntiTheftStatus = new DevExpress.XtraLayout.SimpleLabelItem();
+ this.emptySpaceItem6 = new DevExpress.XtraLayout.EmptySpaceItem();
+ this.layoutControlItemClearActivation = new DevExpress.XtraLayout.LayoutControlItem();
this.gbBmsDateTime = new DevExpress.XtraEditors.GroupControl();
this.layoutControl3 = new DevExpress.XtraLayout.LayoutControl();
this.BtnGetCurrTime = new DevExpress.XtraEditors.SimpleButton();
@@ -79,22 +88,27 @@
this.layoutControlItem2 = new DevExpress.XtraLayout.LayoutControlItem();
this.layoutControlItem3 = new DevExpress.XtraLayout.LayoutControlItem();
this.simpleLabelItem2 = new DevExpress.XtraLayout.SimpleLabelItem();
- this.TeAntiTheftGyroCurr = new DevExpress.XtraEditors.TextEdit();
this.layoutControlGroup1 = new DevExpress.XtraLayout.LayoutControlGroup();
this.layoutControlItem19 = new DevExpress.XtraLayout.LayoutControlItem();
this.layoutControlItem4 = new DevExpress.XtraLayout.LayoutControlItem();
this.layoutControlItem8 = new DevExpress.XtraLayout.LayoutControlItem();
this.emptySpaceItem5 = new DevExpress.XtraLayout.EmptySpaceItem();
- this.layoutControlGroup3 = new DevExpress.XtraLayout.LayoutControlGroup();
- this.emptySpaceItem6 = new DevExpress.XtraLayout.EmptySpaceItem();
- this.layoutControlItem17 = new DevExpress.XtraLayout.LayoutControlItem();
- this.layoutControlItem21 = new DevExpress.XtraLayout.LayoutControlItem();
- this.layoutControlItem20 = new DevExpress.XtraLayout.LayoutControlItem();
- this.layoutControlItem15 = new DevExpress.XtraLayout.LayoutControlItem();
- this.layoutControlItem16 = new DevExpress.XtraLayout.LayoutControlItem();
+ this.layoutControlItemAntiTheftGroup = new DevExpress.XtraLayout.LayoutControlItem();
((System.ComponentModel.ISupportInitialize)(this.layoutControl1)).BeginInit();
this.layoutControl1.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.gbAntiTheft)).BeginInit();
+ this.gbAntiTheft.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.layoutControl4)).BeginInit();
+ this.layoutControl4.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.TeSensitive.Properties)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.TeAntiTheftGyroCurr.Properties)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup4)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem16)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem17)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.simpleLabelItemAntiTheftStatus)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem6)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.layoutControlItemClearAlarm)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.layoutControlItemClearActivation)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.gbBmsDateTime)).BeginInit();
this.gbBmsDateTime.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.layoutControl3)).BeginInit();
@@ -143,31 +157,20 @@
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem3)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.simpleLabelItem2)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.TeAntiTheftGyroCurr.Properties)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem19)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem4)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem8)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem5)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup3)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem6)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem17)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem21)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem20)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem15)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem16)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.layoutControlItemAntiTheftGroup)).BeginInit();
this.SuspendLayout();
//
// layoutControl1
//
- this.layoutControl1.Controls.Add(this.TeSensitive);
- this.layoutControl1.Controls.Add(this.BtnAntiTheftEnable);
- this.layoutControl1.Controls.Add(this.BtnClearAntiTheftProtect);
- this.layoutControl1.Controls.Add(this.BtnAntiTheftDisable);
+ this.layoutControl1.Controls.Add(this.gbAntiTheft);
this.layoutControl1.Controls.Add(this.gbBmsDateTime);
this.layoutControl1.Controls.Add(this.gbChaModeControl);
this.layoutControl1.Controls.Add(this.gbCapacityControl);
- this.layoutControl1.Controls.Add(this.TeAntiTheftGyroCurr);
this.layoutControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.layoutControl1.Location = new System.Drawing.Point(0, 0);
this.layoutControl1.Name = "layoutControl1";
@@ -177,47 +180,170 @@
this.layoutControl1.TabIndex = 0;
this.layoutControl1.Text = "layoutControl1";
//
+ // gbAntiTheft
+ //
+ this.gbAntiTheft.Controls.Add(this.layoutControl4);
+ this.gbAntiTheft.Location = new System.Drawing.Point(2, 212);
+ this.gbAntiTheft.Name = "gbAntiTheft";
+ this.gbAntiTheft.Size = new System.Drawing.Size(282, 192);
+ this.gbAntiTheft.TabIndex = 13;
+ this.gbAntiTheft.Text = "Anti-Theft";
+ //
+ // layoutControl4
+ //
+ this.layoutControl4.Controls.Add(this.BtnClearAlarm);
+ this.layoutControl4.Controls.Add(this.BtnClearActivation);
+ this.layoutControl4.Controls.Add(this.TeSensitive);
+ this.layoutControl4.Controls.Add(this.TeAntiTheftGyroCurr);
+ this.layoutControl4.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.layoutControl4.Location = new System.Drawing.Point(2, 23);
+ this.layoutControl4.Name = "layoutControl4";
+ this.layoutControl4.Root = this.layoutControlGroup4;
+ this.layoutControl4.Size = new System.Drawing.Size(278, 167);
+ this.layoutControl4.TabIndex = 0;
+ this.layoutControl4.Text = "layoutControl4";
+ //
// TeSensitive
//
- this.TeSensitive.Location = new System.Drawing.Point(86, 265);
+ this.TeSensitive.Location = new System.Drawing.Point(88, 3);
this.TeSensitive.Name = "TeSensitive";
this.TeSensitive.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 11.25F);
this.TeSensitive.Properties.Appearance.Options.UseFont = true;
this.TeSensitive.Properties.Appearance.Options.UseTextOptions = true;
this.TeSensitive.Properties.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Far;
this.TeSensitive.Properties.ReadOnly = true;
- this.TeSensitive.Size = new System.Drawing.Size(194, 24);
- this.TeSensitive.TabIndex = 18;
+ this.TeSensitive.Size = new System.Drawing.Size(187, 24);
+ this.TeSensitive.StyleController = this.layoutControl4;
+ this.TeSensitive.TabIndex = 4;
//
- // BtnAntiTheftEnable
+ // TeAntiTheftGyroCurr
//
- this.BtnAntiTheftEnable.Location = new System.Drawing.Point(109, 365);
- this.BtnAntiTheftEnable.Name = "BtnAntiTheftEnable";
- this.BtnAntiTheftEnable.Size = new System.Drawing.Size(85, 35);
- this.BtnAntiTheftEnable.StyleController = this.layoutControl1;
- this.BtnAntiTheftEnable.TabIndex = 17;
- this.BtnAntiTheftEnable.Text = "Enable";
- this.BtnAntiTheftEnable.Click += new System.EventHandler(this.BtnAntiTheftEnable_Click);
+ this.TeAntiTheftGyroCurr.Location = new System.Drawing.Point(88, 31);
+ this.TeAntiTheftGyroCurr.Name = "TeAntiTheftGyroCurr";
+ this.TeAntiTheftGyroCurr.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 11.25F);
+ this.TeAntiTheftGyroCurr.Properties.Appearance.Options.UseFont = true;
+ this.TeAntiTheftGyroCurr.Properties.Appearance.Options.UseTextOptions = true;
+ this.TeAntiTheftGyroCurr.Properties.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Far;
+ this.TeAntiTheftGyroCurr.Properties.ReadOnly = true;
+ this.TeAntiTheftGyroCurr.Size = new System.Drawing.Size(187, 24);
+ this.TeAntiTheftGyroCurr.StyleController = this.layoutControl4;
+ this.TeAntiTheftGyroCurr.TabIndex = 5;
//
- // BtnClearAntiTheftProtect
+ // BtnClearAlarm
//
- this.BtnClearAntiTheftProtect.Location = new System.Drawing.Point(6, 365);
- this.BtnClearAntiTheftProtect.Name = "BtnClearAntiTheftProtect";
- this.BtnClearAntiTheftProtect.Size = new System.Drawing.Size(99, 35);
- this.BtnClearAntiTheftProtect.StyleController = this.layoutControl1;
- this.BtnClearAntiTheftProtect.TabIndex = 16;
- this.BtnClearAntiTheftProtect.Text = "Clear Protect";
- this.BtnClearAntiTheftProtect.Click += new System.EventHandler(this.BtnClearAntiTheftProtect_Click);
+ this.BtnClearAlarm.Location = new System.Drawing.Point(3, 127);
+ this.BtnClearAlarm.Name = "BtnClearAlarm";
+ this.BtnClearAlarm.Size = new System.Drawing.Size(133, 37);
+ this.BtnClearAlarm.StyleController = this.layoutControl4;
+ this.BtnClearAlarm.TabIndex = 6;
+ this.BtnClearAlarm.Text = "Clear Alarm";
+ this.BtnClearAlarm.Click += new System.EventHandler(this.BtnClearAlarm_Click);
//
- // BtnAntiTheftDisable
+ // BtnClearActivation
//
- this.BtnAntiTheftDisable.Location = new System.Drawing.Point(198, 365);
- this.BtnAntiTheftDisable.Name = "BtnAntiTheftDisable";
- this.BtnAntiTheftDisable.Size = new System.Drawing.Size(82, 35);
- this.BtnAntiTheftDisable.StyleController = this.layoutControl1;
- this.BtnAntiTheftDisable.TabIndex = 15;
- this.BtnAntiTheftDisable.Text = "Disable";
- this.BtnAntiTheftDisable.Click += new System.EventHandler(this.BtnAntiTheftDisable_Click);
+ this.BtnClearActivation.Location = new System.Drawing.Point(140, 127);
+ this.BtnClearActivation.Name = "BtnClearActivation";
+ this.BtnClearActivation.Size = new System.Drawing.Size(135, 37);
+ this.BtnClearActivation.StyleController = this.layoutControl4;
+ this.BtnClearActivation.TabIndex = 7;
+ this.BtnClearActivation.Text = "Clear Activation";
+ this.BtnClearActivation.Click += new System.EventHandler(this.BtnClearActivation_Click);
+ //
+ // layoutControlGroup4
+ //
+ this.layoutControlGroup4.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.True;
+ this.layoutControlGroup4.GroupBordersVisible = false;
+ this.layoutControlGroup4.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] {
+ this.layoutControlItem16,
+ this.layoutControlItem17,
+ this.simpleLabelItemAntiTheftStatus,
+ this.emptySpaceItem6,
+ this.layoutControlItemClearAlarm,
+ this.layoutControlItemClearActivation});
+ this.layoutControlGroup4.Name = "layoutControlGroup4";
+ this.layoutControlGroup4.Padding = new DevExpress.XtraLayout.Utils.Padding(1, 1, 1, 1);
+ this.layoutControlGroup4.Size = new System.Drawing.Size(278, 167);
+ this.layoutControlGroup4.TextVisible = false;
+ //
+ // layoutControlItem16
+ //
+ this.layoutControlItem16.AppearanceItemCaption.Options.UseTextOptions = true;
+ this.layoutControlItem16.AppearanceItemCaption.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Near;
+ this.layoutControlItem16.Control = this.TeSensitive;
+ this.layoutControlItem16.Location = new System.Drawing.Point(0, 0);
+ this.layoutControlItem16.MinSize = new System.Drawing.Size(115, 28);
+ this.layoutControlItem16.Name = "layoutControlItem16";
+ this.layoutControlItem16.Size = new System.Drawing.Size(276, 28);
+ this.layoutControlItem16.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
+ this.layoutControlItem16.Text = " Sensitive";
+ this.layoutControlItem16.TextAlignMode = DevExpress.XtraLayout.TextAlignModeItem.CustomSize;
+ this.layoutControlItem16.TextSize = new System.Drawing.Size(80, 20);
+ this.layoutControlItem16.TextToControlDistance = 5;
+ //
+ // layoutControlItem17
+ //
+ this.layoutControlItem17.AppearanceItemCaption.Options.UseTextOptions = true;
+ this.layoutControlItem17.AppearanceItemCaption.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Near;
+ this.layoutControlItem17.Control = this.TeAntiTheftGyroCurr;
+ this.layoutControlItem17.Location = new System.Drawing.Point(0, 28);
+ this.layoutControlItem17.MinSize = new System.Drawing.Size(115, 28);
+ this.layoutControlItem17.Name = "layoutControlItem17";
+ this.layoutControlItem17.Size = new System.Drawing.Size(276, 28);
+ this.layoutControlItem17.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
+ this.layoutControlItem17.Text = " Status";
+ this.layoutControlItem17.TextAlignMode = DevExpress.XtraLayout.TextAlignModeItem.CustomSize;
+ this.layoutControlItem17.TextSize = new System.Drawing.Size(80, 20);
+ this.layoutControlItem17.TextToControlDistance = 5;
+ //
+ // simpleLabelItemAntiTheftStatus
+ //
+ this.simpleLabelItemAntiTheftStatus.AllowHotTrack = false;
+ this.simpleLabelItemAntiTheftStatus.AppearanceItemCaption.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.simpleLabelItemAntiTheftStatus.AppearanceItemCaption.ForeColor = System.Drawing.Color.Blue;
+ this.simpleLabelItemAntiTheftStatus.AppearanceItemCaption.Options.UseFont = true;
+ this.simpleLabelItemAntiTheftStatus.AppearanceItemCaption.Options.UseForeColor = true;
+ this.simpleLabelItemAntiTheftStatus.AppearanceItemCaption.Options.UseTextOptions = true;
+ this.simpleLabelItemAntiTheftStatus.AppearanceItemCaption.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Far;
+ this.simpleLabelItemAntiTheftStatus.Location = new System.Drawing.Point(0, 56);
+ this.simpleLabelItemAntiTheftStatus.MinSize = new System.Drawing.Size(274, 22);
+ this.simpleLabelItemAntiTheftStatus.Name = "simpleLabelItemAntiTheftStatus";
+ this.simpleLabelItemAntiTheftStatus.Size = new System.Drawing.Size(276, 22);
+ this.simpleLabelItemAntiTheftStatus.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
+ this.simpleLabelItemAntiTheftStatus.Text = " Waiting for charging activation";
+ this.simpleLabelItemAntiTheftStatus.TextAlignMode = DevExpress.XtraLayout.TextAlignModeItem.CustomSize;
+ this.simpleLabelItemAntiTheftStatus.TextSize = new System.Drawing.Size(270, 18);
+ //
+ // emptySpaceItem6
+ //
+ this.emptySpaceItem6.AllowHotTrack = false;
+ this.emptySpaceItem6.Location = new System.Drawing.Point(0, 78);
+ this.emptySpaceItem6.MinSize = new System.Drawing.Size(104, 24);
+ this.emptySpaceItem6.Name = "emptySpaceItem6";
+ this.emptySpaceItem6.Size = new System.Drawing.Size(276, 46);
+ this.emptySpaceItem6.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
+ this.emptySpaceItem6.TextSize = new System.Drawing.Size(0, 0);
+ //
+ // layoutControlItemClearAlarm
+ //
+ this.layoutControlItemClearAlarm.Control = this.BtnClearAlarm;
+ this.layoutControlItemClearAlarm.Location = new System.Drawing.Point(0, 124);
+ this.layoutControlItemClearAlarm.MinSize = new System.Drawing.Size(80, 35);
+ this.layoutControlItemClearAlarm.Name = "layoutControlItemClearAlarm";
+ this.layoutControlItemClearAlarm.Size = new System.Drawing.Size(137, 41);
+ this.layoutControlItemClearAlarm.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
+ this.layoutControlItemClearAlarm.TextSize = new System.Drawing.Size(0, 0);
+ this.layoutControlItemClearAlarm.TextVisible = false;
+ //
+ // layoutControlItemClearActivation
+ //
+ this.layoutControlItemClearActivation.Control = this.BtnClearActivation;
+ this.layoutControlItemClearActivation.Location = new System.Drawing.Point(137, 124);
+ this.layoutControlItemClearActivation.MinSize = new System.Drawing.Size(80, 35);
+ this.layoutControlItemClearActivation.Name = "layoutControlItemClearActivation";
+ this.layoutControlItemClearActivation.Size = new System.Drawing.Size(139, 41);
+ this.layoutControlItemClearActivation.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
+ this.layoutControlItemClearActivation.TextSize = new System.Drawing.Size(0, 0);
+ this.layoutControlItemClearActivation.TextVisible = false;
//
// gbBmsDateTime
//
@@ -770,19 +896,6 @@
this.simpleLabelItem2.Text = " %";
this.simpleLabelItem2.TextSize = new System.Drawing.Size(19, 14);
//
- // TeAntiTheftGyroCurr
- //
- this.TeAntiTheftGyroCurr.Location = new System.Drawing.Point(86, 237);
- this.TeAntiTheftGyroCurr.Name = "TeAntiTheftGyroCurr";
- this.TeAntiTheftGyroCurr.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 11.25F);
- this.TeAntiTheftGyroCurr.Properties.Appearance.Options.UseFont = true;
- this.TeAntiTheftGyroCurr.Properties.Appearance.Options.UseTextOptions = true;
- this.TeAntiTheftGyroCurr.Properties.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Far;
- this.TeAntiTheftGyroCurr.Properties.ReadOnly = true;
- this.TeAntiTheftGyroCurr.Size = new System.Drawing.Size(194, 24);
- this.TeAntiTheftGyroCurr.StyleController = this.layoutControl1;
- this.TeAntiTheftGyroCurr.TabIndex = 13;
- //
// layoutControlGroup1
//
this.layoutControlGroup1.CustomizationFormText = "layoutControlGroup1";
@@ -793,7 +906,7 @@
this.layoutControlItem4,
this.layoutControlItem8,
this.emptySpaceItem5,
- this.layoutControlGroup3});
+ this.layoutControlItemAntiTheftGroup});
this.layoutControlGroup1.Name = "Root";
this.layoutControlGroup1.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0);
this.layoutControlGroup1.Size = new System.Drawing.Size(838, 406);
@@ -841,90 +954,17 @@
this.emptySpaceItem5.Size = new System.Drawing.Size(552, 196);
this.emptySpaceItem5.TextSize = new System.Drawing.Size(0, 0);
//
- // layoutControlGroup3
+ // layoutControlItemAntiTheftGroup
//
- this.layoutControlGroup3.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] {
- this.emptySpaceItem6,
- this.layoutControlItem17,
- this.layoutControlItem21,
- this.layoutControlItem20,
- this.layoutControlItem15,
- this.layoutControlItem16});
- this.layoutControlGroup3.Location = new System.Drawing.Point(0, 210);
- this.layoutControlGroup3.Name = "layoutControlGroup3";
- this.layoutControlGroup3.Padding = new DevExpress.XtraLayout.Utils.Padding(1, 1, 1, 1);
- this.layoutControlGroup3.Size = new System.Drawing.Size(286, 196);
- this.layoutControlGroup3.Text = "Anti-Theft";
- //
- // emptySpaceItem6
- //
- this.emptySpaceItem6.AllowHotTrack = false;
- this.emptySpaceItem6.Location = new System.Drawing.Point(0, 56);
- this.emptySpaceItem6.Name = "emptySpaceItem6";
- this.emptySpaceItem6.Size = new System.Drawing.Size(278, 72);
- this.emptySpaceItem6.TextSize = new System.Drawing.Size(0, 0);
- //
- // layoutControlItem17
- //
- this.layoutControlItem17.Control = this.TeAntiTheftGyroCurr;
- this.layoutControlItem17.ControlAlignment = System.Drawing.ContentAlignment.TopLeft;
- this.layoutControlItem17.CustomizationFormText = " Gyro-Scope Curr";
- this.layoutControlItem17.Location = new System.Drawing.Point(0, 0);
- this.layoutControlItem17.MaxSize = new System.Drawing.Size(0, 28);
- this.layoutControlItem17.MinSize = new System.Drawing.Size(134, 28);
- this.layoutControlItem17.Name = "layoutControlItem17";
- this.layoutControlItem17.Size = new System.Drawing.Size(278, 28);
- this.layoutControlItem17.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
- this.layoutControlItem17.Text = " Gyro Scope";
- this.layoutControlItem17.TextAlignMode = DevExpress.XtraLayout.TextAlignModeItem.CustomSize;
- this.layoutControlItem17.TextSize = new System.Drawing.Size(75, 20);
- this.layoutControlItem17.TextToControlDistance = 5;
- //
- // layoutControlItem21
- //
- this.layoutControlItem21.Control = this.BtnAntiTheftDisable;
- this.layoutControlItem21.Location = new System.Drawing.Point(192, 128);
- this.layoutControlItem21.MinSize = new System.Drawing.Size(30, 26);
- this.layoutControlItem21.Name = "layoutControlItem21";
- this.layoutControlItem21.Size = new System.Drawing.Size(86, 39);
- this.layoutControlItem21.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
- this.layoutControlItem21.TextSize = new System.Drawing.Size(0, 0);
- this.layoutControlItem21.TextVisible = false;
- //
- // layoutControlItem20
- //
- this.layoutControlItem20.Control = this.BtnClearAntiTheftProtect;
- this.layoutControlItem20.Location = new System.Drawing.Point(0, 128);
- this.layoutControlItem20.MinSize = new System.Drawing.Size(30, 26);
- this.layoutControlItem20.Name = "layoutControlItem20";
- this.layoutControlItem20.Size = new System.Drawing.Size(103, 39);
- this.layoutControlItem20.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
- this.layoutControlItem20.TextSize = new System.Drawing.Size(0, 0);
- this.layoutControlItem20.TextVisible = false;
- //
- // layoutControlItem15
- //
- this.layoutControlItem15.Control = this.BtnAntiTheftEnable;
- this.layoutControlItem15.Location = new System.Drawing.Point(103, 128);
- this.layoutControlItem15.MinSize = new System.Drawing.Size(30, 26);
- this.layoutControlItem15.Name = "layoutControlItem15";
- this.layoutControlItem15.Size = new System.Drawing.Size(89, 39);
- this.layoutControlItem15.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
- this.layoutControlItem15.TextSize = new System.Drawing.Size(0, 0);
- this.layoutControlItem15.TextVisible = false;
- //
- // layoutControlItem16
- //
- this.layoutControlItem16.Control = this.TeSensitive;
- this.layoutControlItem16.Location = new System.Drawing.Point(0, 28);
- this.layoutControlItem16.MinSize = new System.Drawing.Size(178, 28);
- this.layoutControlItem16.Name = "layoutControlItem16";
- this.layoutControlItem16.Size = new System.Drawing.Size(278, 28);
- this.layoutControlItem16.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
- this.layoutControlItem16.Text = " Sensitive";
- this.layoutControlItem16.TextAlignMode = DevExpress.XtraLayout.TextAlignModeItem.CustomSize;
- this.layoutControlItem16.TextSize = new System.Drawing.Size(75, 14);
- this.layoutControlItem16.TextToControlDistance = 5;
+ this.layoutControlItemAntiTheftGroup.Control = this.gbAntiTheft;
+ this.layoutControlItemAntiTheftGroup.Location = new System.Drawing.Point(0, 210);
+ this.layoutControlItemAntiTheftGroup.MaxSize = new System.Drawing.Size(286, 196);
+ this.layoutControlItemAntiTheftGroup.MinSize = new System.Drawing.Size(286, 196);
+ this.layoutControlItemAntiTheftGroup.Name = "layoutControlItemAntiTheftGroup";
+ this.layoutControlItemAntiTheftGroup.Size = new System.Drawing.Size(286, 196);
+ this.layoutControlItemAntiTheftGroup.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
+ this.layoutControlItemAntiTheftGroup.TextSize = new System.Drawing.Size(0, 0);
+ this.layoutControlItemAntiTheftGroup.TextVisible = false;
//
// ucCalibration
//
@@ -935,7 +975,19 @@
this.Size = new System.Drawing.Size(838, 406);
((System.ComponentModel.ISupportInitialize)(this.layoutControl1)).EndInit();
this.layoutControl1.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.gbAntiTheft)).EndInit();
+ this.gbAntiTheft.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.layoutControl4)).EndInit();
+ this.layoutControl4.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.TeSensitive.Properties)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.TeAntiTheftGyroCurr.Properties)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup4)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem16)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem17)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.simpleLabelItemAntiTheftStatus)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem6)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.layoutControlItemClearAlarm)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.layoutControlItemClearActivation)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.gbBmsDateTime)).EndInit();
this.gbBmsDateTime.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.layoutControl3)).EndInit();
@@ -984,19 +1036,12 @@
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem3)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.simpleLabelItem2)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.TeAntiTheftGyroCurr.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem19)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem4)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem8)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem5)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup3)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem6)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem17)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem21)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem20)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem15)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem16)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.layoutControlItemAntiTheftGroup)).EndInit();
this.ResumeLayout(false);
}
@@ -1055,17 +1100,20 @@
private DevExpress.XtraEditors.TextEdit TeChgModeValueNew;
private DevExpress.XtraLayout.LayoutControlItem layoutControlItem14;
private DevExpress.XtraLayout.EmptySpaceItem emptySpaceItem5;
- private DevExpress.XtraLayout.LayoutControlGroup layoutControlGroup3;
- private DevExpress.XtraLayout.EmptySpaceItem emptySpaceItem6;
- private DevExpress.XtraEditors.TextEdit TeAntiTheftGyroCurr;
- private DevExpress.XtraLayout.LayoutControlItem layoutControlItem17;
- private DevExpress.XtraEditors.SimpleButton BtnAntiTheftDisable;
- private DevExpress.XtraLayout.LayoutControlItem layoutControlItem21;
- private DevExpress.XtraEditors.SimpleButton BtnClearAntiTheftProtect;
- private DevExpress.XtraLayout.LayoutControlItem layoutControlItem20;
- private DevExpress.XtraEditors.SimpleButton BtnAntiTheftEnable;
- private DevExpress.XtraLayout.LayoutControlItem layoutControlItem15;
+ private DevExpress.XtraEditors.GroupControl gbAntiTheft;
+ private DevExpress.XtraLayout.LayoutControlItem layoutControlItemAntiTheftGroup;
+ private DevExpress.XtraLayout.LayoutControl layoutControl4;
+ private DevExpress.XtraLayout.LayoutControlGroup layoutControlGroup4;
private DevExpress.XtraEditors.TextEdit TeSensitive;
private DevExpress.XtraLayout.LayoutControlItem layoutControlItem16;
+ private DevExpress.XtraEditors.TextEdit TeAntiTheftGyroCurr;
+ private DevExpress.XtraLayout.LayoutControlItem layoutControlItem17;
+ private DevExpress.XtraLayout.SimpleLabelItem simpleLabelItemAntiTheftStatus;
+ private DevExpress.XtraLayout.EmptySpaceItem emptySpaceItem6;
+ private DevExpress.XtraEditors.SimpleButton BtnClearAlarm;
+ private DevExpress.XtraLayout.LayoutControlItem layoutControlItemClearAlarm;
+ private DevExpress.XtraEditors.SimpleButton BtnClearActivation;
+ private DevExpress.XtraLayout.LayoutControlItem layoutControlItemClearActivation;
}
}
+
diff --git a/LFP_Manager/Controls/ucCalibration.cs b/LFP_Manager/Controls/ucCalibration.cs
index d4f3160..159ba26 100644
--- a/LFP_Manager/Controls/ucCalibration.cs
+++ b/LFP_Manager/Controls/ucCalibration.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
@@ -133,15 +133,17 @@ namespace LFP_Manager.Controls
TeCurrDateTime.Text = string.Format("{0:yyyy-MM-dd HH:mm:ss}", SystemData.BmsDateTime);
// Anti-Theft Data Display
+ TeSensitive.Text = string.Format("{0}", SystemData.CalibriationData.AntiTheft.GyroScope);
+ TeAntiTheftGyroCurr.Text = string.Format("{0}", SystemData.CalibriationData.AntiTheft.Status);
+
if (SystemData.CalibriationData.AntiTheft.GyroScope == 0)
{
- TeAntiTheftGyroCurr.Text = "DISABLE";
+ simpleLabelItemAntiTheftStatus.Text = "DISABLE";
}
else
{
- TeAntiTheftGyroCurr.Text = "ENABLE";
+ simpleLabelItemAntiTheftStatus.Text = csConstData.SystemInfo.GetAntiTheftStatusString(SystemData.CalibriationData.AntiTheft.Status);
}
- TeSensitive.Text = string.Format("{0}", SystemData.CalibriationData.AntiTheft.GyroScope);
if (dFlag == 0)
{
@@ -218,9 +220,9 @@ namespace LFP_Manager.Controls
{
TeNewDateTime.Text = string.Format("{0:yyyy-MM-dd HH:mm:ss}", DateTime.Now);
}
- private void BtnClearAntiTheftProtect_Click(object sender, EventArgs e)
+ private void BtnClearAlarm_Click(object sender, EventArgs e)
{
- // Anti Theft Data Clear
+ // Anti Theft Clear Alarm (Send 1 to 0x0089)
PasswordResult = 0;
foreach (Form frm in Application.OpenForms)
@@ -239,7 +241,34 @@ namespace LFP_Manager.Controls
if (PasswordResult == 1)
{
wCalib = rCalib.DeepCopy();
- wCalib.AntiTheft.GyroScope = Config.GyroSensitive;
+ wCalib.AntiTheft.GyroScope = 1;
+
+ OnCommnadEvent(19, CALC_INDEX, 1, ref rParam, ref wCalib);
+ }
+ }
+
+ private void BtnClearActivation_Click(object sender, EventArgs e)
+ {
+ // Anti Theft Clear Activation (Set Sensitive to 0)
+ PasswordResult = 0;
+
+ foreach (Form frm in Application.OpenForms)
+ {
+ if (frm.Name == "FmxPassword")
+ {
+ frm.Activate();
+ return;
+ }
+ }
+ FmxPassword PasswordForm = new FmxPassword(Config, 0);
+
+ PasswordForm.OnResult += PassWordResultProc;
+ PasswordForm.ShowDialog();
+
+ if (PasswordResult == 1)
+ {
+ wCalib = rCalib.DeepCopy();
+ wCalib.AntiTheft.GyroScope = 0;
OnCommnadEvent(19, CALC_INDEX, 1, ref rParam, ref wCalib);
}
@@ -249,62 +278,6 @@ namespace LFP_Manager.Controls
{
PasswordResult = result;
}
-
- private void BtnAntiTheftEnable_Click(object sender, EventArgs e)
- {
- // Anti Theft Data Get
- PasswordResult = 0;
-
- foreach (Form frm in Application.OpenForms)
- {
- if (frm.Name == "FmxPassword")
- {
- frm.Activate();
- return;
- }
- }
- FmxPassword PasswordForm = new FmxPassword(Config, 1);
-
- PasswordForm.OnResult += PassWordResultProc;
- PasswordForm.ShowDialog();
-
- if (PasswordResult == 1)
- {
- wCalib = rCalib.DeepCopy();
-
- wCalib.AntiTheft.GyroScope = Config.GyroSensitive;
-
- OnCommnadEvent(18, CALC_INDEX, 1, ref rParam, ref wCalib);
- }
- }
-
- private void BtnAntiTheftDisable_Click(object sender, EventArgs e)
- {
- // Anti Theft Data Get
- PasswordResult = 0;
-
- foreach (Form frm in Application.OpenForms)
- {
- if (frm.Name == "FmxPassword")
- {
- frm.Activate();
- return;
- }
- }
- FmxPassword PasswordForm = new FmxPassword(Config, 2);
-
- PasswordForm.OnResult += PassWordResultProc;
- PasswordForm.ShowDialog();
-
- if (PasswordResult == 1)
- {
- wCalib = rCalib.DeepCopy();
-
- wCalib.AntiTheft.GyroScope = 0;
-
- OnCommnadEvent(18, CALC_INDEX, 1, ref rParam, ref wCalib);
- }
- }
#endregion
#region COMPONENT EVENT
diff --git a/LFP_Manager/Controls/ucEventLog.Designer.cs b/LFP_Manager/Controls/ucEventLog.Designer.cs
index 6867e73..2a710fb 100644
--- a/LFP_Manager/Controls/ucEventLog.Designer.cs
+++ b/LFP_Manager/Controls/ucEventLog.Designer.cs
@@ -1,4 +1,4 @@
-namespace LFP_Manager.Controls
+namespace LFP_Manager.Controls
{
partial class ucEventLog
{
@@ -32,6 +32,7 @@
this.gcLogging = new DevExpress.XtraEditors.GroupControl();
this.layoutControl2 = new DevExpress.XtraLayout.LayoutControl();
this.cbPacketLog = new DevExpress.XtraEditors.CheckEdit();
+ this.btnAnalyzer = new DevExpress.XtraEditors.SimpleButton();
this.btnLogClear = new DevExpress.XtraEditors.SimpleButton();
this.tabDataLog = new DevExpress.XtraTab.XtraTabControl();
this.tpDataLog = new DevExpress.XtraTab.XtraTabPage();
@@ -39,8 +40,9 @@
this.meDataLog = new DevExpress.XtraEditors.MemoEdit();
this.layoutControlGroup2 = new DevExpress.XtraLayout.LayoutControlGroup();
this.layoutControlItem6 = new DevExpress.XtraLayout.LayoutControlItem();
- this.layoutControlItem14 = new DevExpress.XtraLayout.LayoutControlItem();
this.lcCheckEdit = new DevExpress.XtraLayout.LayoutControlItem();
+ this.layoutControlItemAnalyzer = new DevExpress.XtraLayout.LayoutControlItem();
+ this.layoutControlItem14 = new DevExpress.XtraLayout.LayoutControlItem();
this.layoutControlGroup1 = new DevExpress.XtraLayout.LayoutControlGroup();
this.layoutControlItem1 = new DevExpress.XtraLayout.LayoutControlItem();
((System.ComponentModel.ISupportInitialize)(this.layoutControl1)).BeginInit();
@@ -58,8 +60,9 @@
((System.ComponentModel.ISupportInitialize)(this.meDataLog.Properties)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem6)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem14)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.lcCheckEdit)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.layoutControlItemAnalyzer)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem14)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).BeginInit();
this.SuspendLayout();
@@ -90,6 +93,7 @@
//
this.layoutControl2.AllowCustomization = false;
this.layoutControl2.Controls.Add(this.cbPacketLog);
+ this.layoutControl2.Controls.Add(this.btnAnalyzer);
this.layoutControl2.Controls.Add(this.btnLogClear);
this.layoutControl2.Controls.Add(this.tabDataLog);
this.layoutControl2.Dock = System.Windows.Forms.DockStyle.Fill;
@@ -110,11 +114,21 @@
this.cbPacketLog.StyleController = this.layoutControl2;
this.cbPacketLog.TabIndex = 6;
//
+ // btnAnalyzer
+ //
+ this.btnAnalyzer.Location = new System.Drawing.Point(702, 28);
+ this.btnAnalyzer.Name = "btnAnalyzer";
+ this.btnAnalyzer.Size = new System.Drawing.Size(83, 50);
+ this.btnAnalyzer.StyleController = this.layoutControl2;
+ this.btnAnalyzer.TabIndex = 7;
+ this.btnAnalyzer.Text = "Analyzer";
+ this.btnAnalyzer.Click += new System.EventHandler(this.btnAnalyzer_Click);
+ //
// btnLogClear
//
- this.btnLogClear.Location = new System.Drawing.Point(702, 28);
+ this.btnLogClear.Location = new System.Drawing.Point(702, 82);
this.btnLogClear.Name = "btnLogClear";
- this.btnLogClear.Size = new System.Drawing.Size(83, 110);
+ this.btnLogClear.Size = new System.Drawing.Size(83, 56);
this.btnLogClear.StyleController = this.layoutControl2;
this.btnLogClear.TabIndex = 5;
this.btnLogClear.Text = "Clear";
@@ -162,8 +176,9 @@
this.layoutControlGroup2.GroupBordersVisible = false;
this.layoutControlGroup2.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] {
this.layoutControlItem6,
- this.layoutControlItem14,
- this.lcCheckEdit});
+ this.lcCheckEdit,
+ this.layoutControlItemAnalyzer,
+ this.layoutControlItem14});
this.layoutControlGroup2.Name = "layoutControlGroup2";
this.layoutControlGroup2.Padding = new DevExpress.XtraLayout.Utils.Padding(2, 2, 2, 2);
this.layoutControlGroup2.Size = new System.Drawing.Size(789, 142);
@@ -181,18 +196,6 @@
this.layoutControlItem6.TextSize = new System.Drawing.Size(0, 0);
this.layoutControlItem6.TextVisible = false;
//
- // layoutControlItem14
- //
- this.layoutControlItem14.Control = this.btnLogClear;
- this.layoutControlItem14.CustomizationFormText = "layoutControlItem14";
- this.layoutControlItem14.Location = new System.Drawing.Point(698, 24);
- this.layoutControlItem14.MinSize = new System.Drawing.Size(60, 26);
- this.layoutControlItem14.Name = "layoutControlItem14";
- this.layoutControlItem14.Size = new System.Drawing.Size(87, 114);
- this.layoutControlItem14.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
- this.layoutControlItem14.TextSize = new System.Drawing.Size(0, 0);
- this.layoutControlItem14.TextVisible = false;
- //
// lcCheckEdit
//
this.lcCheckEdit.Control = this.cbPacketLog;
@@ -205,6 +208,30 @@
this.lcCheckEdit.TextSize = new System.Drawing.Size(0, 0);
this.lcCheckEdit.TextVisible = false;
//
+ // layoutControlItemAnalyzer
+ //
+ this.layoutControlItemAnalyzer.Control = this.btnAnalyzer;
+ this.layoutControlItemAnalyzer.CustomizationFormText = "layoutControlItemAnalyzer";
+ this.layoutControlItemAnalyzer.Location = new System.Drawing.Point(698, 24);
+ this.layoutControlItemAnalyzer.MinSize = new System.Drawing.Size(60, 26);
+ this.layoutControlItemAnalyzer.Name = "layoutControlItemAnalyzer";
+ this.layoutControlItemAnalyzer.Size = new System.Drawing.Size(87, 54);
+ this.layoutControlItemAnalyzer.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
+ this.layoutControlItemAnalyzer.TextSize = new System.Drawing.Size(0, 0);
+ this.layoutControlItemAnalyzer.TextVisible = false;
+ //
+ // layoutControlItem14
+ //
+ this.layoutControlItem14.Control = this.btnLogClear;
+ this.layoutControlItem14.CustomizationFormText = "layoutControlItem14";
+ this.layoutControlItem14.Location = new System.Drawing.Point(698, 78);
+ this.layoutControlItem14.MinSize = new System.Drawing.Size(60, 26);
+ this.layoutControlItem14.Name = "layoutControlItem14";
+ this.layoutControlItem14.Size = new System.Drawing.Size(87, 60);
+ this.layoutControlItem14.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
+ this.layoutControlItem14.TextSize = new System.Drawing.Size(0, 0);
+ this.layoutControlItem14.TextVisible = false;
+ //
// layoutControlGroup1
//
this.layoutControlGroup1.CustomizationFormText = "layoutControlGroup1";
@@ -249,8 +276,9 @@
((System.ComponentModel.ISupportInitialize)(this.meDataLog.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem6)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem14)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.lcCheckEdit)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.layoutControlItemAnalyzer)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem14)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).EndInit();
this.ResumeLayout(false);
@@ -263,6 +291,7 @@
private DevExpress.XtraLayout.LayoutControlGroup layoutControlGroup1;
private DevExpress.XtraEditors.GroupControl gcLogging;
private DevExpress.XtraLayout.LayoutControl layoutControl2;
+ private DevExpress.XtraEditors.SimpleButton btnAnalyzer;
private DevExpress.XtraEditors.SimpleButton btnLogClear;
private DevExpress.XtraTab.XtraTabControl tabDataLog;
private DevExpress.XtraTab.XtraTabPage tpDataLog;
@@ -270,6 +299,7 @@
private DevExpress.XtraEditors.MemoEdit meDataLog;
private DevExpress.XtraLayout.LayoutControlGroup layoutControlGroup2;
private DevExpress.XtraLayout.LayoutControlItem layoutControlItem6;
+ private DevExpress.XtraLayout.LayoutControlItem layoutControlItemAnalyzer;
private DevExpress.XtraLayout.LayoutControlItem layoutControlItem14;
private DevExpress.XtraLayout.LayoutControlItem layoutControlItem1;
private DevExpress.XtraEditors.CheckEdit cbPacketLog;
diff --git a/LFP_Manager/Controls/ucEventLog.cs b/LFP_Manager/Controls/ucEventLog.cs
index 7de9ca7..c45667b 100644
--- a/LFP_Manager/Controls/ucEventLog.cs
+++ b/LFP_Manager/Controls/ucEventLog.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
@@ -23,6 +23,8 @@ namespace LFP_Manager.Controls
#region PUBLIC UPDATE
+ public event EventHandler OnPacketAnalyzerClick = null;
+
public void EventUpdate(string aEvent)
{
if (this.InvokeRequired)
@@ -44,6 +46,11 @@ namespace LFP_Manager.Controls
#region ENVENT
+ private void btnAnalyzer_Click(object sender, EventArgs e)
+ {
+ OnPacketAnalyzerClick?.Invoke(this, EventArgs.Empty);
+ }
+
private void btnLogClear_Click(object sender, EventArgs e)
{
meDataLog.Text = "";
diff --git a/LFP_Manager/Controls/ucHistroy.cs b/LFP_Manager/Controls/ucHistroy.cs
index 07aa233..a1846d7 100644
--- a/LFP_Manager/Controls/ucHistroy.cs
+++ b/LFP_Manager/Controls/ucHistroy.cs
@@ -466,7 +466,8 @@ namespace LFP_Manager.Controls
private string GetOpStatusDisplayText(short val)
{
- switch ((ushort)val)
+ ushort uval = (ushort)(val & 0x7FFF);
+ switch (uval)
{
case 0x0000: return "STANDBY (0x0000)";
case 0x0001: return "CHARGING (0x0001)";
@@ -475,12 +476,7 @@ namespace LFP_Manager.Controls
case 0x0004: return "TRIP (0x0004)";
case 0x0008: return "CHG-LIMIT (0x0008)";
case 0x0032: return "POWER-ON (0x0032)";
- case 0x8000: return "STANDBY-HEAT (0x8000)";
- case 0x8001: return "CHARGING-HEAT (0x8001)";
- case 0x8002: return "DISCHARGING-HEAT (0x8002)";
- case 0x8004: return "TRIP-HEAT (0x8004)";
- case 0x8008: return "CHG-LIMIT-HEAT (0x8008)";
- default: return string.Format("UNKNOWN (0x{0:X4})", (ushort)val);
+ default: return string.Format("UNKNOWN (0x{0:X4})", uval);
}
}
diff --git a/LFP_Manager/Controls/ucShelfStatus.cs b/LFP_Manager/Controls/ucShelfStatus.cs
index 47d2125..6506651 100644
--- a/LFP_Manager/Controls/ucShelfStatus.cs
+++ b/LFP_Manager/Controls/ucShelfStatus.cs
@@ -689,7 +689,7 @@ namespace LFP_Manager.Controls
{
if (SystemData.ShelfCommFail == false)
{
- switch ((int)SystemData.StatusData.status)
+ switch ((int)SystemData.StatusData.status & 0x7FFF)
{
case 0x0000: // Stand by
lbStatus.Text = "STANDBY";
@@ -719,28 +719,8 @@ namespace LFP_Manager.Controls
lbStatus.Text = "CHG-LIMIT";
lbStatus.ForeColor = System.Drawing.Color.Blue;
break;
- case 0x8000: // Stand by - Heat
- lbStatus.Text = "STANDBY-HEAT";
- lbStatus.ForeColor = System.Drawing.Color.Blue;
- break;
- case 0x8001: // Charging
- lbStatus.Text = "CHARGING-HEAT";
- lbStatus.ForeColor = System.Drawing.Color.Blue;
- break;
- case 0x8002: // Discharging
- lbStatus.Text = "DISCHARGING-HEAT";
- lbStatus.ForeColor = System.Drawing.Color.Magenta;
- break;
- case 0x8004: // TRIP
- lbStatus.Text = "TRIP-HEAT";
- lbStatus.ForeColor = System.Drawing.Color.Red;
- break;
- case 0x8008: // Chg-Lmt
- lbStatus.Text = "CHG-LIMIT-HEAT";
- lbStatus.ForeColor = System.Drawing.Color.Blue;
- break;
default:
- lbStatus.Text = string.Format("UNKNOWN(0x{0:X4})", (ushort)SystemData.StatusData.status);
+ lbStatus.Text = string.Format("UNKNOWN(0x{0:X4})", (ushort)(SystemData.StatusData.status & 0x7FFF));
lbStatus.ForeColor = System.Drawing.Color.Black;
break;
}
@@ -842,7 +822,8 @@ namespace LFP_Manager.Controls
private void DisplayAlarm()
{
- gbAlarm.Text = string.Format("Alarm && Fault ( ERROR: 0x{0:X4} )", (ushort)SystemData.StatusData.errorCode);
+ string chgWaitStr = (((ushort)SystemData.StatusData.status & 0x8000) == 0) ? " - Wait for Charging" : "";
+ gbAlarm.Text = string.Format("Alarm && Fault ( ERROR: 0x{0:X4} ){1}", (ushort)SystemData.StatusData.errorCode, chgWaitStr);
bool[] aFault = csUtils.Int16ToBitArray(SystemData.StatusData.protection);
bool[] aWarining = csUtils.Int16ToBitArray(SystemData.StatusData.warning);
diff --git a/LFP_Manager/DataStructure/csConstData.cs b/LFP_Manager/DataStructure/csConstData.cs
index 7d5d225..ac616e2 100644
--- a/LFP_Manager/DataStructure/csConstData.cs
+++ b/LFP_Manager/DataStructure/csConstData.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -29,6 +29,21 @@ namespace LFP_Manager.DataStructure
"Unknown7", // 7
"PRE-CHG + LMT", // 8
};
+
+ public static readonly string[] ANTI_THEFT_STATUS =
+ {
+ "Waiting for charging activation", // 0
+ "Activated", // 1
+ };
+
+ public static string GetAntiTheftStatusString(int status)
+ {
+ if (status >= 0 && status < ANTI_THEFT_STATUS.Length)
+ {
+ return ANTI_THEFT_STATUS[status];
+ }
+ return string.Format("Unknown ({0})", status);
+ }
}
public class CommType
diff --git a/LFP_Manager/DataStructure/csDataStructure.cs b/LFP_Manager/DataStructure/csDataStructure.cs
index 7caa9a4..67a5736 100644
--- a/LFP_Manager/DataStructure/csDataStructure.cs
+++ b/LFP_Manager/DataStructure/csDataStructure.cs
@@ -551,11 +551,13 @@ namespace LFP_Manager.DataStructure
{
public int Comm;
public int GyroScope;
+ public int Status;
public TAntiTheft()
{
Comm = 0;
GyroScope = 0;
+ Status = 0;
}
public TAntiTheft DeepCopy()
{
@@ -563,6 +565,7 @@ namespace LFP_Manager.DataStructure
{
Comm = Comm,
GyroScope = GyroScope,
+ Status = Status,
};
return newCopy;
}
@@ -688,6 +691,41 @@ namespace LFP_Manager.DataStructure
}
}
+ public enum UartTxType
+ {
+ Polling, // 주기적 상태 조회
+ WriteParam, // 파라미터 쓰기 (Holding Register)
+ WriteReg, // 레지스터 쓰기
+ WriteCoil, // 코일 쓰기
+ ReadReg, // 레지스터 읽기
+ FwUpdate, // 펌웨어 업데이트
+ Raw // 기타 원시 패킷
+ }
+
+ public class TUartTxItem
+ {
+ public UartTxType TxType { get; set; } = UartTxType.Raw;
+ public int SystemId { get; set; } = 0;
+ public ushort RegAddr { get; set; } = 0;
+ public ushort RegLen { get; set; } = 0;
+ public byte[] Data { get; set; } = null;
+ public bool ExpectReply { get; set; } = true;
+ public int TimeoutMs { get; set; } = 500;
+
+ public TUartTxItem() { }
+
+ public TUartTxItem(UartTxType type, int sysId, ushort regAddr, ushort regLen, byte[] data, bool expectReply = true, int timeoutMs = 500)
+ {
+ TxType = type;
+ SystemId = sysId;
+ RegAddr = regAddr;
+ RegLen = regLen;
+ Data = data;
+ ExpectReply = expectReply;
+ TimeoutMs = timeoutMs;
+ }
+ }
+
public class TUartTxBuff
{
public int InPos;
@@ -731,3 +769,4 @@ namespace LFP_Manager.DataStructure
}
}
+
diff --git a/LFP_Manager/Forms/fmxCalibration.Designer.cs b/LFP_Manager/Forms/fmxCalibration.Designer.cs
index b9945c1..b2fc746 100644
--- a/LFP_Manager/Forms/fmxCalibration.Designer.cs
+++ b/LFP_Manager/Forms/fmxCalibration.Designer.cs
@@ -55,15 +55,15 @@
this.layoutControl1.Name = "layoutControl1";
this.layoutControl1.OptionsCustomizationForm.DesignTimeCustomizationFormPositionAndSize = new System.Drawing.Rectangle(1265, 291, 250, 350);
this.layoutControl1.Root = this.layoutControlGroup1;
- this.layoutControl1.Size = new System.Drawing.Size(814, 444);
+ this.layoutControl1.Size = new System.Drawing.Size(814, 457);
this.layoutControl1.TabIndex = 0;
this.layoutControl1.Text = "layoutControl1";
//
// btnClose
//
- this.btnClose.Location = new System.Drawing.Point(714, 403);
+ this.btnClose.Location = new System.Drawing.Point(714, 415);
this.btnClose.Name = "btnClose";
- this.btnClose.Size = new System.Drawing.Size(96, 37);
+ this.btnClose.Size = new System.Drawing.Size(96, 38);
this.btnClose.StyleController = this.layoutControl1;
this.btnClose.TabIndex = 5;
this.btnClose.Text = "Close";
@@ -80,17 +80,17 @@
this.emptySpaceItem1});
this.layoutControlGroup1.Name = "Root";
this.layoutControlGroup1.Padding = new DevExpress.XtraLayout.Utils.Padding(2, 2, 2, 2);
- this.layoutControlGroup1.Size = new System.Drawing.Size(814, 444);
+ this.layoutControlGroup1.Size = new System.Drawing.Size(814, 457);
this.layoutControlGroup1.TextVisible = false;
//
// layoutControlItem2
//
this.layoutControlItem2.Control = this.btnClose;
this.layoutControlItem2.CustomizationFormText = "layoutControlItem2";
- this.layoutControlItem2.Location = new System.Drawing.Point(710, 399);
+ this.layoutControlItem2.Location = new System.Drawing.Point(710, 411);
this.layoutControlItem2.MinSize = new System.Drawing.Size(93, 26);
this.layoutControlItem2.Name = "layoutControlItem2";
- this.layoutControlItem2.Size = new System.Drawing.Size(100, 41);
+ this.layoutControlItem2.Size = new System.Drawing.Size(100, 42);
this.layoutControlItem2.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
this.layoutControlItem2.TextSize = new System.Drawing.Size(0, 0);
this.layoutControlItem2.TextVisible = false;
@@ -99,9 +99,9 @@
//
this.emptySpaceItem1.AllowHotTrack = false;
this.emptySpaceItem1.CustomizationFormText = "emptySpaceItem1";
- this.emptySpaceItem1.Location = new System.Drawing.Point(0, 399);
+ this.emptySpaceItem1.Location = new System.Drawing.Point(0, 411);
this.emptySpaceItem1.Name = "emptySpaceItem1";
- this.emptySpaceItem1.Size = new System.Drawing.Size(710, 41);
+ this.emptySpaceItem1.Size = new System.Drawing.Size(710, 42);
this.emptySpaceItem1.TextSize = new System.Drawing.Size(0, 0);
//
// tmrDisplay
@@ -113,7 +113,7 @@
//
this.ucCalibrationConfig.Location = new System.Drawing.Point(4, 4);
this.ucCalibrationConfig.Name = "ucCalibrationConfig";
- this.ucCalibrationConfig.Size = new System.Drawing.Size(806, 395);
+ this.ucCalibrationConfig.Size = new System.Drawing.Size(806, 407);
this.ucCalibrationConfig.TabIndex = 4;
//
// layoutControlItem1
@@ -123,7 +123,7 @@
this.layoutControlItem1.Location = new System.Drawing.Point(0, 0);
this.layoutControlItem1.MinSize = new System.Drawing.Size(104, 24);
this.layoutControlItem1.Name = "layoutControlItem1";
- this.layoutControlItem1.Size = new System.Drawing.Size(810, 399);
+ this.layoutControlItem1.Size = new System.Drawing.Size(810, 411);
this.layoutControlItem1.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
this.layoutControlItem1.TextSize = new System.Drawing.Size(0, 0);
this.layoutControlItem1.TextVisible = false;
@@ -132,7 +132,7 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(814, 444);
+ this.ClientSize = new System.Drawing.Size(814, 457);
this.Controls.Add(this.layoutControl1);
this.IconOptions.Icon = ((System.Drawing.Icon)(resources.GetObject("fmxCalibration.IconOptions.Icon")));
this.Name = "fmxCalibration";
diff --git a/LFP_Manager/Forms/fmxHistory.Designer.cs b/LFP_Manager/Forms/fmxHistory.Designer.cs
index db6daaf..1b39f42 100644
--- a/LFP_Manager/Forms/fmxHistory.Designer.cs
+++ b/LFP_Manager/Forms/fmxHistory.Designer.cs
@@ -1,4 +1,4 @@
-namespace LFP_Manager.Forms
+namespace LFP_Manager.Forms
{
partial class fmxHistory
{
@@ -44,6 +44,7 @@
this.gvBmsHistory = new DevExpress.XtraGrid.Views.Grid.GridView();
this.gcHistDateTime = new DevExpress.XtraGrid.Columns.GridColumn();
this.gcStatus = new DevExpress.XtraGrid.Columns.GridColumn();
+ this.gcChgWait = new DevExpress.XtraGrid.Columns.GridColumn();
this.gcWarning = new DevExpress.XtraGrid.Columns.GridColumn();
this.gcProtect = new DevExpress.XtraGrid.Columns.GridColumn();
this.gcError = new DevExpress.XtraGrid.Columns.GridColumn();
@@ -239,6 +240,7 @@
this.gcNo,
this.gcHistDateTime,
this.gcStatus,
+ this.gcChgWait,
this.gcWarning,
this.gcProtect,
this.gcError,
@@ -298,6 +300,18 @@
this.gcStatus.Visible = true;
this.gcStatus.VisibleIndex = 2;
//
+ // gcChgWait
+ //
+ this.gcChgWait.AppearanceCell.Options.UseTextOptions = true;
+ this.gcChgWait.AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
+ this.gcChgWait.AppearanceHeader.Options.UseTextOptions = true;
+ this.gcChgWait.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
+ this.gcChgWait.Caption = "Chg Wait Status";
+ this.gcChgWait.FieldName = "chg_wait";
+ this.gcChgWait.Name = "gcChgWait";
+ this.gcChgWait.Visible = true;
+ this.gcChgWait.VisibleIndex = 3;
+ //
// gcWarning
//
this.gcWarning.AppearanceCell.Options.UseTextOptions = true;
@@ -308,7 +322,7 @@
this.gcWarning.FieldName = "warning";
this.gcWarning.Name = "gcWarning";
this.gcWarning.Visible = true;
- this.gcWarning.VisibleIndex = 3;
+ this.gcWarning.VisibleIndex = 4;
//
// gcProtect
//
@@ -320,7 +334,7 @@
this.gcProtect.FieldName = "protect";
this.gcProtect.Name = "gcProtect";
this.gcProtect.Visible = true;
- this.gcProtect.VisibleIndex = 4;
+ this.gcProtect.VisibleIndex = 5;
//
// gcError
//
@@ -332,7 +346,7 @@
this.gcError.FieldName = "error";
this.gcError.Name = "gcError";
this.gcError.Visible = true;
- this.gcError.VisibleIndex = 5;
+ this.gcError.VisibleIndex = 6;
//
// gcVoltage
//
@@ -346,7 +360,7 @@
this.gcVoltage.FieldName = "voltage";
this.gcVoltage.Name = "gcVoltage";
this.gcVoltage.Visible = true;
- this.gcVoltage.VisibleIndex = 6;
+ this.gcVoltage.VisibleIndex = 7;
//
// gcCurrent
//
@@ -360,7 +374,7 @@
this.gcCurrent.FieldName = "current";
this.gcCurrent.Name = "gcCurrent";
this.gcCurrent.Visible = true;
- this.gcCurrent.VisibleIndex = 7;
+ this.gcCurrent.VisibleIndex = 8;
//
// gcSOC
//
@@ -373,7 +387,7 @@
this.gcSOC.FieldName = "SOC";
this.gcSOC.Name = "gcSOC";
this.gcSOC.Visible = true;
- this.gcSOC.VisibleIndex = 8;
+ this.gcSOC.VisibleIndex = 9;
//
// gcSOH
//
@@ -386,7 +400,7 @@
this.gcSOH.FieldName = "SOH";
this.gcSOH.Name = "gcSOH";
this.gcSOH.Visible = true;
- this.gcSOH.VisibleIndex = 9;
+ this.gcSOH.VisibleIndex = 10;
//
// gcTemp1
//
@@ -898,6 +912,7 @@
private DevExpress.XtraLayout.LayoutControlGroup layoutControlGroup4;
private DevExpress.XtraGrid.Columns.GridColumn gcHistDateTime;
private DevExpress.XtraGrid.Columns.GridColumn gcStatus;
+ private DevExpress.XtraGrid.Columns.GridColumn gcChgWait;
private DevExpress.XtraGrid.Columns.GridColumn gcWarning;
private DevExpress.XtraGrid.Columns.GridColumn gcProtect;
private DevExpress.XtraGrid.Columns.GridColumn gcError;
diff --git a/LFP_Manager/Forms/fmxHistory.cs b/LFP_Manager/Forms/fmxHistory.cs
index 6af41f2..462db37 100644
--- a/LFP_Manager/Forms/fmxHistory.cs
+++ b/LFP_Manager/Forms/fmxHistory.cs
@@ -103,6 +103,7 @@ namespace LFP_Manager.Forms
hDT.Columns.Add("no", typeof(int));
hDT.Columns.Add("datetime", typeof(string));
hDT.Columns.Add("status", typeof(int));
+ hDT.Columns.Add("chg_wait", typeof(int));
hDT.Columns.Add("warning", typeof(short));
hDT.Columns.Add("protect", typeof(short));
hDT.Columns.Add("error", typeof(short));
@@ -116,7 +117,7 @@ namespace LFP_Manager.Forms
{
hDT.Columns.Add(string.Format("temp_{0:00}", i + 1), typeof(float));
}
- for (int i = 0; i < 16; i++)
+ for (int i = 0; i < csConstData.SystemInfo.MAX_MODULE_CELL_SIZE; i++)
{
hDT.Columns.Add(string.Format("cell_v_{0:00}", i + 1), typeof(float));
}
@@ -146,8 +147,8 @@ namespace LFP_Manager.Forms
{
if (bms_history_req == false || data == null) return;
- // BMS History response packet: Addr(1) + Func(1) + ByteCount(1 = 58) + Data(58) + CRC(2) = 63 bytes
- if (data.Length >= 63 && data[1] == 0x03 && data[2] == 58)
+ // BMS History response packet: Addr(1) + Func(1) + ByteCount(1 = 56) + Data(56) + CRC(2) = 61 bytes
+ if (data.Length >= 61 && data[1] == 0x03 && data[2] == 56)
{
try
{
@@ -184,7 +185,9 @@ namespace LFP_Manager.Forms
hRow["datetime"] = stDateTime;
pos = 2;
- hRow["status"] = shorts[pos++];
+ short rawStatus = shorts[pos++];
+ hRow["status"] = (int)(rawStatus & 0x7FFF);
+ hRow["chg_wait"] = ((rawStatus & 0x8000) != 0) ? 1 : 0;
hRow["warning"] = shorts[pos++];
hRow["protect"] = shorts[pos++];
hRow["error"] = shorts[pos++];
@@ -192,14 +195,14 @@ namespace LFP_Manager.Forms
hRow["current"] = string.Format("{0:0.00}", Convert.ToDouble(shorts[pos++]) / 100);
hRow["SOC"] = string.Format("{0:0.0}", Convert.ToDouble(shorts[pos++]) / 1);
- // Temperature
+ // Temperature (3 registers = 6 temps)
for (int i = 0; i < 3; i++)
{
hRow[string.Format("temp_{0:00}", (i * 2) + 1)] = Convert.ToDouble((byte)(shorts[pos] >> 8));
hRow[string.Format("temp_{0:00}", (i * 2) + 2)] = Convert.ToDouble((byte)(shorts[pos++] >> 0));
}
- // Cell Voltage
- for (int i = 0; i < 16; i++)
+ // Cell Voltage (15 cells)
+ for (int i = 0; i < csConstData.SystemInfo.MAX_MODULE_CELL_SIZE; i++)
{
hRow[string.Format("cell_v_{0:00}", i + 1)] = Convert.ToDouble(shorts[pos++]) / 1000;
}
@@ -278,14 +281,14 @@ namespace LFP_Manager.Forms
sdata[2] = (byte)(addr >> 8); // Address H
sdata[3] = (byte)(addr >> 0); // Address L
sdata[4] = 0x00; // Number of Register H
- sdata[5] = 0x1D; // Number of Register L
+ sdata[5] = 0x1C; // Number of Register L (28 registers = 56 bytes)
crc = csSerialCommFunction.GetCRC(sdata, 6);
sdata[6] = crc[1]; // CRCH
sdata[7] = crc[0]; // CRCL
- OnSendUartData?.Invoke(addr, sdata, false);
+ OnSendUartData?.Invoke(addr, sdata, true);
}
private void gvBmsHistory_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
@@ -294,7 +297,7 @@ namespace LFP_Manager.Forms
if (e.Column.FieldName == "status")
{
- int status = Convert.ToInt32(e.Value);
+ int status = Convert.ToInt32(e.Value) & 0x7FFF;
switch ((ushort)status)
{
case 0x0000: e.DisplayText = "STANDBY (0x0000)"; break;
@@ -304,11 +307,6 @@ namespace LFP_Manager.Forms
case 0x0004: e.DisplayText = "TRIP (0x0004)"; break;
case 0x0008: e.DisplayText = "CHG-LIMIT (0x0008)"; break;
case 0x0032: e.DisplayText = "POWER-ON (0x0032)"; break;
- case 0x8000: e.DisplayText = "STANDBY-HEAT (0x8000)"; break;
- case 0x8001: e.DisplayText = "CHARGING-HEAT (0x8001)"; break;
- case 0x8002: e.DisplayText = "DISCHARGING-HEAT (0x8002)"; break;
- case 0x8004: e.DisplayText = "TRIP-HEAT (0x8004)"; break;
- case 0x8008: e.DisplayText = "CHG-LIMIT-HEAT (0x8008)"; break;
default: e.DisplayText = string.Format("UNKNOWN (0x{0:X4})", status); break;
}
}
diff --git a/LFP_Manager/Forms/fmxMain.Designer.cs b/LFP_Manager/Forms/fmxMain.Designer.cs
index 57df2a2..9af9324 100644
--- a/LFP_Manager/Forms/fmxMain.Designer.cs
+++ b/LFP_Manager/Forms/fmxMain.Designer.cs
@@ -58,6 +58,8 @@ namespace LFP_Manager.Forms
this.historyViewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.updateToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.firmwareUpdateToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.toolsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.packetAnalyzerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.settingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.changePasswordToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
((System.ComponentModel.ISupportInitialize)(this.layoutControl1)).BeginInit();
@@ -311,6 +313,7 @@ namespace LFP_Manager.Forms
this.fileToolStripMenuItem,
this.historyToolStripMenuItem,
this.updateToolStripMenuItem,
+ this.toolsToolStripMenuItem,
this.settingsToolStripMenuItem});
this.mnMain.Location = new System.Drawing.Point(0, 0);
this.mnMain.Name = "mnMain";
@@ -363,6 +366,21 @@ namespace LFP_Manager.Forms
this.firmwareUpdateToolStripMenuItem.Text = "Firmware Update";
this.firmwareUpdateToolStripMenuItem.Click += new System.EventHandler(this.firmwareUpdateToolStripMenuItem_Click);
//
+ // toolsToolStripMenuItem
+ //
+ this.toolsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.packetAnalyzerToolStripMenuItem});
+ this.toolsToolStripMenuItem.Name = "toolsToolStripMenuItem";
+ this.toolsToolStripMenuItem.Size = new System.Drawing.Size(46, 20);
+ this.toolsToolStripMenuItem.Text = "Tools";
+ //
+ // packetAnalyzerToolStripMenuItem
+ //
+ this.packetAnalyzerToolStripMenuItem.Name = "packetAnalyzerToolStripMenuItem";
+ this.packetAnalyzerToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
+ this.packetAnalyzerToolStripMenuItem.Text = "Packet Analyzer";
+ this.packetAnalyzerToolStripMenuItem.Click += new System.EventHandler(this.packetAnalyzerToolStripMenuItem_Click);
+ //
// settingsToolStripMenuItem
//
this.settingsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@@ -374,7 +392,7 @@ namespace LFP_Manager.Forms
// changePasswordToolStripMenuItem
//
this.changePasswordToolStripMenuItem.Name = "changePasswordToolStripMenuItem";
- this.changePasswordToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
+ this.changePasswordToolStripMenuItem.Size = new System.Drawing.Size(168, 22);
this.changePasswordToolStripMenuItem.Text = "Change Password";
this.changePasswordToolStripMenuItem.Click += new System.EventHandler(this.changePasswordToolStripMenuItem_Click);
//
@@ -386,6 +404,7 @@ namespace LFP_Manager.Forms
this.Controls.Add(this.layoutControl1);
this.Controls.Add(this.mnMain);
this.IconOptions.Icon = ((System.Drawing.Icon)(resources.GetObject("fmxMain.IconOptions.Icon")));
+ this.MainMenuStrip = this.mnMain;
this.Name = "fmxMain";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "LFP SYSTEM";
@@ -443,6 +462,8 @@ namespace LFP_Manager.Forms
private System.Windows.Forms.ToolStripMenuItem historyViewToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem updateToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem firmwareUpdateToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem toolsToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem packetAnalyzerToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem settingsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem changePasswordToolStripMenuItem;
}
diff --git a/LFP_Manager/Forms/fmxMain.cs b/LFP_Manager/Forms/fmxMain.cs
index c2aa38e..4c41865 100644
--- a/LFP_Manager/Forms/fmxMain.cs
+++ b/LFP_Manager/Forms/fmxMain.cs
@@ -26,6 +26,7 @@ namespace LFP_Manager.Forms
private fmxModuleDetail ModuleDetailForm = null;
private fmxFwUpdate FwUpdateForm = null;
private fmxHistory HistoryForm = null;
+ private fmxPacketLog PacketLogForm = null;
// Static Variables
CommConfig Config = new CommConfig();
@@ -64,6 +65,7 @@ namespace LFP_Manager.Forms
uTarget.OnStart += StartButtonClick;
uDataLog.OnUpdate += LogStatusUpdate;
+ uEventLog.OnPacketAnalyzerClick += packetAnalyzerToolStripMenuItem_Click;
this.Text = String.Format("LFP SYSTEM [{0}] -- TW (for DBG)", Application.ProductVersion);
}
@@ -210,6 +212,7 @@ namespace LFP_Manager.Forms
uartThread.OnUpdate += UpdateData;
uartThread.OnDataRecv += UartRecvData;
uartThread.OnPrint += CommDataPrint;
+ uartThread.OnPacketLog += PacketLogUpdate;
uartThread.SetPolling(chbPolling.Checked, sId, ref SystemData);
if (uartThread.Start(ref Config, sId, chbPolling.Checked))
@@ -813,6 +816,21 @@ namespace LFP_Manager.Forms
}
}
+ private void packetAnalyzerToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ if (PacketLogForm == null || PacketLogForm.IsDisposed)
+ {
+ PacketLogForm = new fmxPacketLog();
+ }
+ PacketLogForm.Show();
+ PacketLogForm.BringToFront();
+ }
+
+ private void PacketLogUpdate(DateTime timestamp, bool isTx, byte[] packet, string description)
+ {
+ PacketLogForm?.AddPacketLog(timestamp, isTx, packet, description);
+ }
+
#endregion
#region FORM EVENT
diff --git a/LFP_Manager/Forms/fmxPacketLog.Designer.cs b/LFP_Manager/Forms/fmxPacketLog.Designer.cs
new file mode 100644
index 0000000..b7f942f
--- /dev/null
+++ b/LFP_Manager/Forms/fmxPacketLog.Designer.cs
@@ -0,0 +1,354 @@
+namespace LFP_Manager.Forms
+{
+ partial class fmxPacketLog
+ {
+ ///
+ /// 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.panelTop = new DevExpress.XtraEditors.PanelControl();
+ this.btnCapture = new DevExpress.XtraEditors.SimpleButton();
+ this.btnClear = new DevExpress.XtraEditors.SimpleButton();
+ this.chkAutoScroll = new DevExpress.XtraEditors.CheckEdit();
+ this.btnExport = new DevExpress.XtraEditors.SimpleButton();
+ this.cmbFilter = new DevExpress.XtraEditors.ComboBoxEdit();
+ this.lblFilter = new DevExpress.XtraEditors.LabelControl();
+ this.lblStatus = new DevExpress.XtraEditors.LabelControl();
+ this.splitContainerControl = new DevExpress.XtraEditors.SplitContainerControl();
+ this.gcPacketLog = new DevExpress.XtraGrid.GridControl();
+ this.gvPacketLog = new DevExpress.XtraGrid.Views.Grid.GridView();
+ this.colNo = new DevExpress.XtraGrid.Columns.GridColumn();
+ this.colTime = new DevExpress.XtraGrid.Columns.GridColumn();
+ this.colDir = new DevExpress.XtraGrid.Columns.GridColumn();
+ this.colDevId = new DevExpress.XtraGrid.Columns.GridColumn();
+ this.colFunc = new DevExpress.XtraGrid.Columns.GridColumn();
+ this.colLen = new DevExpress.XtraGrid.Columns.GridColumn();
+ this.colHex = new DevExpress.XtraGrid.Columns.GridColumn();
+ this.colDesc = new DevExpress.XtraGrid.Columns.GridColumn();
+ this.colCrc = new DevExpress.XtraGrid.Columns.GridColumn();
+ this.groupDetail = new DevExpress.XtraEditors.GroupControl();
+ this.txtDetail = new DevExpress.XtraEditors.MemoEdit();
+ ((System.ComponentModel.ISupportInitialize)(this.panelTop)).BeginInit();
+ this.panelTop.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.chkAutoScroll.Properties)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.cmbFilter.Properties)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.splitContainerControl)).BeginInit();
+ this.splitContainerControl.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.gcPacketLog)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.gvPacketLog)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.groupDetail)).BeginInit();
+ this.groupDetail.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.txtDetail.Properties)).BeginInit();
+ this.SuspendLayout();
+ //
+ // panelTop
+ //
+ this.panelTop.Controls.Add(this.lblStatus);
+ this.panelTop.Controls.Add(this.lblFilter);
+ this.panelTop.Controls.Add(this.cmbFilter);
+ this.panelTop.Controls.Add(this.btnExport);
+ this.panelTop.Controls.Add(this.chkAutoScroll);
+ this.panelTop.Controls.Add(this.btnClear);
+ this.panelTop.Controls.Add(this.btnCapture);
+ this.panelTop.Dock = System.Windows.Forms.DockStyle.Top;
+ this.panelTop.Location = new System.Drawing.Point(0, 0);
+ this.panelTop.Name = "panelTop";
+ this.panelTop.Size = new System.Drawing.Size(984, 46);
+ this.panelTop.TabIndex = 0;
+ //
+ // btnCapture
+ //
+ this.btnCapture.Location = new System.Drawing.Point(12, 10);
+ this.btnCapture.Name = "btnCapture";
+ this.btnCapture.Size = new System.Drawing.Size(85, 26);
+ this.btnCapture.TabIndex = 0;
+ this.btnCapture.Text = "Pause";
+ this.btnCapture.Click += new System.EventHandler(this.btnCapture_Click);
+ //
+ // btnClear
+ //
+ this.btnClear.Location = new System.Drawing.Point(103, 10);
+ this.btnClear.Name = "btnClear";
+ this.btnClear.Size = new System.Drawing.Size(75, 26);
+ this.btnClear.TabIndex = 1;
+ this.btnClear.Text = "Clear";
+ this.btnClear.Click += new System.EventHandler(this.btnClear_Click);
+ //
+ // chkAutoScroll
+ //
+ this.chkAutoScroll.EditValue = true;
+ this.chkAutoScroll.Location = new System.Drawing.Point(190, 13);
+ this.chkAutoScroll.Name = "chkAutoScroll";
+ this.chkAutoScroll.Properties.Caption = "Auto Scroll";
+ this.chkAutoScroll.Size = new System.Drawing.Size(85, 20);
+ this.chkAutoScroll.TabIndex = 2;
+ //
+ // btnExport
+ //
+ this.btnExport.Location = new System.Drawing.Point(470, 10);
+ this.btnExport.Name = "btnExport";
+ this.btnExport.Size = new System.Drawing.Size(95, 26);
+ this.btnExport.TabIndex = 3;
+ this.btnExport.Text = "Export Excel";
+ this.btnExport.Click += new System.EventHandler(this.btnExport_Click);
+ //
+ // cmbFilter
+ //
+ this.cmbFilter.EditValue = "ALL";
+ this.cmbFilter.Location = new System.Drawing.Point(340, 13);
+ this.cmbFilter.Name = "cmbFilter";
+ this.cmbFilter.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
+ new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
+ this.cmbFilter.Properties.Items.AddRange(new object[] {
+ "ALL",
+ "TX Only",
+ "RX Only",
+ "Error Only"});
+ this.cmbFilter.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
+ this.cmbFilter.Size = new System.Drawing.Size(110, 20);
+ this.cmbFilter.TabIndex = 4;
+ this.cmbFilter.SelectedIndexChanged += new System.EventHandler(this.cmbFilter_SelectedIndexChanged);
+ //
+ // lblFilter
+ //
+ this.lblFilter.Location = new System.Drawing.Point(295, 16);
+ this.lblFilter.Name = "lblFilter";
+ this.lblFilter.Size = new System.Drawing.Size(39, 14);
+ this.lblFilter.TabIndex = 5;
+ this.lblFilter.Text = "Filter :";
+ //
+ // lblStatus
+ //
+ this.lblStatus.Appearance.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.lblStatus.Appearance.Options.UseFont = true;
+ this.lblStatus.Location = new System.Drawing.Point(590, 16);
+ this.lblStatus.Name = "lblStatus";
+ this.lblStatus.Size = new System.Drawing.Size(200, 14);
+ this.lblStatus.TabIndex = 6;
+ this.lblStatus.Text = "Total: 0 | TX: 0 | RX: 0";
+ //
+ // splitContainerControl
+ //
+ this.splitContainerControl.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.splitContainerControl.Horizontal = false;
+ this.splitContainerControl.Location = new System.Drawing.Point(0, 46);
+ this.splitContainerControl.Name = "splitContainerControl";
+ this.splitContainerControl.Panel1.Controls.Add(this.gcPacketLog);
+ this.splitContainerControl.Panel1.Text = "Panel1";
+ this.splitContainerControl.Panel2.Controls.Add(this.groupDetail);
+ this.splitContainerControl.Panel2.Text = "Panel2";
+ this.splitContainerControl.Size = new System.Drawing.Size(984, 565);
+ this.splitContainerControl.SplitterPosition = 370;
+ this.splitContainerControl.TabIndex = 1;
+ //
+ // gcPacketLog
+ //
+ this.gcPacketLog.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.gcPacketLog.Location = new System.Drawing.Point(0, 0);
+ this.gcPacketLog.MainView = this.gvPacketLog;
+ this.gcPacketLog.Name = "gcPacketLog";
+ this.gcPacketLog.Size = new System.Drawing.Size(984, 370);
+ this.gcPacketLog.TabIndex = 0;
+ this.gcPacketLog.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] {
+ this.gvPacketLog});
+ //
+ // gvPacketLog
+ //
+ this.gvPacketLog.Columns.AddRange(new DevExpress.XtraGrid.Columns.GridColumn[] {
+ this.colNo,
+ this.colTime,
+ this.colDir,
+ this.colDevId,
+ this.colFunc,
+ this.colLen,
+ this.colHex,
+ this.colDesc,
+ this.colCrc});
+ this.gvPacketLog.GridControl = this.gcPacketLog;
+ this.gvPacketLog.Name = "gvPacketLog";
+ this.gvPacketLog.OptionsBehavior.Editable = false;
+ this.gvPacketLog.OptionsBehavior.ReadOnly = true;
+ this.gvPacketLog.OptionsSelection.EnableAppearanceFocusedCell = false;
+ this.gvPacketLog.OptionsView.ShowGroupPanel = false;
+ this.gvPacketLog.OptionsView.ShowIndicator = false;
+ this.gvPacketLog.RowStyle += new DevExpress.XtraGrid.Views.Grid.RowStyleEventHandler(this.gvPacketLog_RowStyle);
+ this.gvPacketLog.FocusedRowChanged += new DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventHandler(this.gvPacketLog_FocusedRowChanged);
+ //
+ // colNo
+ //
+ this.colNo.Caption = "No";
+ this.colNo.FieldName = "no";
+ this.colNo.Name = "colNo";
+ this.colNo.Visible = true;
+ this.colNo.VisibleIndex = 0;
+ this.colNo.Width = 45;
+ //
+ // colTime
+ //
+ this.colTime.Caption = "Time";
+ this.colTime.FieldName = "time";
+ this.colTime.Name = "colTime";
+ this.colTime.Visible = true;
+ this.colTime.VisibleIndex = 1;
+ this.colTime.Width = 90;
+ //
+ // colDir
+ //
+ this.colDir.Caption = "Dir";
+ this.colDir.FieldName = "dir";
+ this.colDir.Name = "colDir";
+ this.colDir.Visible = true;
+ this.colDir.VisibleIndex = 2;
+ this.colDir.Width = 40;
+ //
+ // colDevId
+ //
+ this.colDevId.Caption = "ID";
+ this.colDevId.FieldName = "dev_id";
+ this.colDevId.Name = "colDevId";
+ this.colDevId.Visible = true;
+ this.colDevId.VisibleIndex = 3;
+ this.colDevId.Width = 40;
+ //
+ // colFunc
+ //
+ this.colFunc.Caption = "Func";
+ this.colFunc.FieldName = "func";
+ this.colFunc.Name = "colFunc";
+ this.colFunc.Visible = true;
+ this.colFunc.VisibleIndex = 4;
+ this.colFunc.Width = 50;
+ //
+ // colLen
+ //
+ this.colLen.Caption = "Len";
+ this.colLen.FieldName = "len";
+ this.colLen.Name = "colLen";
+ this.colLen.Visible = true;
+ this.colLen.VisibleIndex = 5;
+ this.colLen.Width = 40;
+ //
+ // colHex
+ //
+ this.colHex.Caption = "RAW HEX Dump";
+ this.colHex.FieldName = "hex";
+ this.colHex.Name = "colHex";
+ this.colHex.Visible = true;
+ this.colHex.VisibleIndex = 6;
+ this.colHex.Width = 350;
+ //
+ // colDesc
+ //
+ this.colDesc.Caption = "Description";
+ this.colDesc.FieldName = "desc";
+ this.colDesc.Name = "colDesc";
+ this.colDesc.Visible = true;
+ this.colDesc.VisibleIndex = 7;
+ this.colDesc.Width = 260;
+ //
+ // colCrc
+ //
+ this.colCrc.Caption = "CRC";
+ this.colCrc.FieldName = "crc";
+ this.colCrc.Name = "colCrc";
+ this.colCrc.Visible = true;
+ this.colCrc.VisibleIndex = 8;
+ this.colCrc.Width = 55;
+ //
+ // groupDetail
+ //
+ this.groupDetail.Controls.Add(this.txtDetail);
+ this.groupDetail.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.groupDetail.Location = new System.Drawing.Point(0, 0);
+ this.groupDetail.Name = "groupDetail";
+ this.groupDetail.Size = new System.Drawing.Size(984, 185);
+ this.groupDetail.TabIndex = 0;
+ this.groupDetail.Text = "Packet Inspector & Analysis";
+ //
+ // txtDetail
+ //
+ this.txtDetail.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.txtDetail.Location = new System.Drawing.Point(2, 23);
+ this.txtDetail.Name = "txtDetail";
+ this.txtDetail.Properties.Appearance.Font = new System.Drawing.Font("Consolas", 9.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.txtDetail.Properties.Appearance.Options.UseFont = true;
+ this.txtDetail.Properties.ReadOnly = true;
+ this.txtDetail.Size = new System.Drawing.Size(980, 160);
+ this.txtDetail.TabIndex = 0;
+ //
+ // fmxPacketLog
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(984, 611);
+ this.Controls.Add(this.splitContainerControl);
+ this.Controls.Add(this.panelTop);
+ this.IconOptions.Image = global::LFP_Manager.Properties.Resources.AMO_LOGO1;
+ this.Name = "fmxPacketLog";
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
+ this.Text = "RS232 Packet Analyzer";
+ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.fmxPacketLog_FormClosing);
+ ((System.ComponentModel.ISupportInitialize)(this.panelTop)).EndInit();
+ this.panelTop.ResumeLayout(false);
+ this.panelTop.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.chkAutoScroll.Properties)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.cmbFilter.Properties)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.splitContainerControl)).EndInit();
+ this.splitContainerControl.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.gcPacketLog)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.gvPacketLog)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.groupDetail)).EndInit();
+ this.groupDetail.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.txtDetail.Properties)).EndInit();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private DevExpress.XtraEditors.PanelControl panelTop;
+ private DevExpress.XtraEditors.SimpleButton btnCapture;
+ private DevExpress.XtraEditors.SimpleButton btnClear;
+ private DevExpress.XtraEditors.CheckEdit chkAutoScroll;
+ private DevExpress.XtraEditors.SimpleButton btnExport;
+ private DevExpress.XtraEditors.ComboBoxEdit cmbFilter;
+ private DevExpress.XtraEditors.LabelControl lblFilter;
+ private DevExpress.XtraEditors.LabelControl lblStatus;
+ private DevExpress.XtraEditors.SplitContainerControl splitContainerControl;
+ private DevExpress.XtraGrid.GridControl gcPacketLog;
+ private DevExpress.XtraGrid.Views.Grid.GridView gvPacketLog;
+ private DevExpress.XtraGrid.Columns.GridColumn colNo;
+ private DevExpress.XtraGrid.Columns.GridColumn colTime;
+ private DevExpress.XtraGrid.Columns.GridColumn colDir;
+ private DevExpress.XtraGrid.Columns.GridColumn colDevId;
+ private DevExpress.XtraGrid.Columns.GridColumn colFunc;
+ private DevExpress.XtraGrid.Columns.GridColumn colLen;
+ private DevExpress.XtraGrid.Columns.GridColumn colHex;
+ private DevExpress.XtraGrid.Columns.GridColumn colDesc;
+ private DevExpress.XtraGrid.Columns.GridColumn colCrc;
+ private DevExpress.XtraEditors.GroupControl groupDetail;
+ private DevExpress.XtraEditors.MemoEdit txtDetail;
+ }
+}
diff --git a/LFP_Manager/Forms/fmxPacketLog.cs b/LFP_Manager/Forms/fmxPacketLog.cs
new file mode 100644
index 0000000..da8bc55
--- /dev/null
+++ b/LFP_Manager/Forms/fmxPacketLog.cs
@@ -0,0 +1,369 @@
+using System;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+using DevExpress.XtraEditors;
+using DevExpress.XtraGrid.Views.Grid;
+using LFP_Manager.Function;
+
+namespace LFP_Manager.Forms
+{
+ public partial class fmxPacketLog : DevExpress.XtraEditors.XtraForm
+ {
+ private DataTable packetTable = null;
+ private int packetIndex = 0;
+ private int txCount = 0;
+ private int rxCount = 0;
+ private bool isCapturing = true;
+ private const int MAX_LOG_COUNT = 5000;
+
+ public fmxPacketLog()
+ {
+ InitializeComponent();
+ InitDataTable();
+ }
+
+ private void InitDataTable()
+ {
+ packetTable = new DataTable();
+ packetTable.Columns.Add("no", typeof(int));
+ packetTable.Columns.Add("time", typeof(string));
+ packetTable.Columns.Add("dir", typeof(string));
+ packetTable.Columns.Add("dev_id", typeof(string));
+ packetTable.Columns.Add("func", typeof(string));
+ packetTable.Columns.Add("len", typeof(int));
+ packetTable.Columns.Add("hex", typeof(string));
+ packetTable.Columns.Add("desc", typeof(string));
+ packetTable.Columns.Add("crc", typeof(string));
+ packetTable.Columns.Add("raw_bytes", typeof(object));
+
+ gcPacketLog.DataSource = packetTable;
+ ApplyFilter();
+ }
+
+ public void AddPacketLog(DateTime timestamp, bool isTx, byte[] data, string description)
+ {
+ if (!isCapturing || data == null || data.Length == 0) return;
+
+ if (this.InvokeRequired)
+ {
+ this.BeginInvoke(new Action(() => AddPacketLogRow(timestamp, isTx, data, description)));
+ }
+ else
+ {
+ AddPacketLogRow(timestamp, isTx, data, description);
+ }
+ }
+
+ private void AddPacketLogRow(DateTime timestamp, bool isTx, byte[] data, string description)
+ {
+ try
+ {
+ if (packetTable == null) return;
+
+ // Max rows management
+ if (packetTable.Rows.Count >= MAX_LOG_COUNT)
+ {
+ for (int i = 0; i < 500; i++)
+ {
+ if (packetTable.Rows.Count > 0)
+ packetTable.Rows.RemoveAt(0);
+ }
+ }
+
+ packetIndex++;
+ if (isTx) txCount++;
+ else rxCount++;
+
+ string dir = isTx ? "TX" : "RX";
+ string devId = data.Length > 0 ? string.Format("0x{0:X2}", data[0]) : "-";
+ string func = data.Length > 1 ? string.Format("0x{0:X2}", data[1]) : "-";
+ int len = data.Length;
+
+ StringBuilder sbHex = new StringBuilder(data.Length * 3);
+ for (int i = 0; i < data.Length; i++)
+ {
+ sbHex.AppendFormat("{0:X2} ", data[i]);
+ }
+ string hex = sbHex.ToString().TrimEnd();
+
+ // CRC Check
+ string crcResult = "OK";
+ if (data.Length >= 4)
+ {
+ byte[] calcCrc = csSerialCommFunction.GetCRC(data, data.Length - 2);
+ byte rxCrcH = data[data.Length - 2];
+ byte rxCrcL = data[data.Length - 1];
+
+ if (calcCrc[1] != rxCrcH || calcCrc[0] != rxCrcL)
+ {
+ crcResult = "ERR";
+ }
+ }
+
+ DataRow row = packetTable.NewRow();
+ row["no"] = packetIndex;
+ row["time"] = timestamp.ToString("HH:mm:ss.fff");
+ row["dir"] = dir;
+ row["dev_id"] = devId;
+ row["func"] = func;
+ row["len"] = len;
+ row["hex"] = hex;
+ row["desc"] = description;
+ row["crc"] = crcResult;
+ row["raw_bytes"] = data;
+
+ packetTable.Rows.Add(row);
+
+ lblStatus.Text = string.Format("Total: {0} | TX: {1} | RX: {2}", packetIndex, txCount, rxCount);
+
+ if (chkAutoScroll.Checked && gvPacketLog.RowCount > 0)
+ {
+ gvPacketLog.MoveLast();
+ }
+ }
+ catch
+ {
+ }
+ }
+
+ private void gvPacketLog_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
+ {
+ DataRow row = gvPacketLog.GetFocusedDataRow();
+ if (row == null)
+ {
+ txtDetail.Text = string.Empty;
+ return;
+ }
+
+ byte[] rawBytes = row["raw_bytes"] as byte[];
+ string dir = row["dir"].ToString();
+ string desc = row["desc"].ToString();
+ string time = row["time"].ToString();
+
+ txtDetail.Text = AnalyzePacket(rawBytes, dir, desc, time);
+ }
+
+ private string AnalyzePacket(byte[] data, string dir, string desc, string time)
+ {
+ if (data == null || data.Length == 0) return "No Data";
+
+ StringBuilder sb = new StringBuilder();
+ sb.AppendLine("================================================================================");
+ sb.AppendLine(string.Format("[{0}] {1} (Length: {2} bytes) - {3}", dir, desc, data.Length, time));
+ sb.AppendLine("================================================================================");
+
+ // 1. Raw HEX Dump formatted
+ sb.AppendLine("[RAW HEX DUMP]");
+ for (int i = 0; i < data.Length; i += 16)
+ {
+ sb.AppendFormat("{0:X4}: ", i);
+ int count = Math.Min(16, data.Length - i);
+ for (int j = 0; j < count; j++)
+ {
+ sb.AppendFormat("{0:X2} ", data[i + j]);
+ }
+ sb.AppendLine();
+ }
+ sb.AppendLine();
+
+ // 2. Modbus Protocol Interpretation
+ sb.AppendLine("[MODBUS FRAME INTERPRETATION]");
+ if (data.Length >= 2)
+ {
+ byte devId = data[0];
+ byte funcCode = data[1];
+
+ sb.AppendLine(string.Format(" - Device (Slave) Address : 0x{0:X2} ({0})", devId));
+ sb.AppendLine(string.Format(" - Function Code : 0x{0:X2} ({1})", funcCode, GetFunctionCodeName(funcCode)));
+
+ if (dir == "TX")
+ {
+ if (data.Length >= 6)
+ {
+ ushort regAddr = (ushort)((data[2] << 8) | data[3]);
+ ushort regCount = (ushort)((data[4] << 8) | data[5]);
+ sb.AppendLine(string.Format(" - Target Register Address: 0x{0:X4} ({0})", regAddr));
+ sb.AppendLine(string.Format(" - Register Count / Value : 0x{0:X4} ({0})", regCount));
+ }
+ }
+ else // RX
+ {
+ if (funcCode == 0x03 && data.Length >= 3)
+ {
+ byte byteCount = data[2];
+ sb.AppendLine(string.Format(" - Data Byte Count : {0} bytes ({1} registers)", byteCount, byteCount / 2));
+
+ int regIndex = 0;
+ for (int p = 3; p + 1 < data.Length - 2; p += 2)
+ {
+ ushort val = (ushort)((data[p] << 8) | data[p + 1]);
+ sb.AppendLine(string.Format(" [Reg +{0:D2}] Offset 0x{1:X2} : 0x{2:X4} ({3})", regIndex++, p - 3, val, (short)val));
+ }
+ }
+ else if (funcCode > 0x80)
+ {
+ byte errCode = data.Length > 2 ? data[2] : (byte)0;
+ sb.AppendLine(string.Format(" - Modbus Exception Code : 0x{0:X2} ({1})", errCode, GetExceptionName(errCode)));
+ }
+ }
+
+ // CRC Check
+ if (data.Length >= 4)
+ {
+ byte[] calcCrc = csSerialCommFunction.GetCRC(data, data.Length - 2);
+ byte rxCrcH = data[data.Length - 2];
+ byte rxCrcL = data[data.Length - 1];
+ bool crcOk = (calcCrc[1] == rxCrcH && calcCrc[0] == rxCrcL);
+
+ sb.AppendLine(string.Format(" - CRC16 Checksum : [H:0x{0:X2}, L:0x{1:X2}] (Calc: 0x{2:X2}{3:X2}) -> {4}",
+ rxCrcH, rxCrcL, calcCrc[1], calcCrc[0], crcOk ? "VALID (OK)" : "INVALID (MISMATCH)"));
+ }
+ }
+
+ return sb.ToString();
+ }
+
+ private string GetFunctionCodeName(byte func)
+ {
+ switch (func)
+ {
+ case 0x01: return "Read Coil Status (0x01)";
+ case 0x02: return "Read Input Status (0x02)";
+ case 0x03: return "Read Holding Registers (0x03)";
+ case 0x04: return "Read Input Registers (0x04)";
+ case 0x05: return "Force Single Coil (0x05)";
+ case 0x06: return "Preset Single Register (0x06)";
+ case 0x10: return "Preset Multiple Registers (0x10)";
+ default:
+ if (func > 0x80) return string.Format("Exception Response (0x{0:X2})", func);
+ return string.Format("Custom / Unknown (0x{0:X2})", func);
+ }
+ }
+
+ private string GetExceptionName(byte err)
+ {
+ switch (err)
+ {
+ case 0x01: return "Illegal Function";
+ case 0x02: return "Illegal Data Address";
+ case 0x03: return "Illegal Data Value";
+ case 0x04: return "Slave Device Failure";
+ case 0x05: return "Acknowledge";
+ case 0x06: return "Slave Device Busy";
+ default: return "Unknown Exception";
+ }
+ }
+
+ private void gvPacketLog_RowStyle(object sender, RowStyleEventArgs e)
+ {
+ if (e.RowHandle < 0) return;
+
+ DataRow row = gvPacketLog.GetDataRow(e.RowHandle);
+ if (row == null) return;
+
+ string dir = row["dir"].ToString();
+ string crc = row["crc"].ToString();
+
+ if (crc == "ERR")
+ {
+ e.Appearance.ForeColor = Color.Red;
+ e.Appearance.Font = new Font(e.Appearance.Font, FontStyle.Bold);
+ }
+ else if (dir == "TX")
+ {
+ e.Appearance.ForeColor = Color.DarkBlue;
+ }
+ else if (dir == "RX")
+ {
+ e.Appearance.ForeColor = Color.DarkGreen;
+ }
+ }
+
+ private void btnCapture_Click(object sender, EventArgs e)
+ {
+ isCapturing = !isCapturing;
+ btnCapture.Text = isCapturing ? "Pause" : "Resume";
+ btnCapture.Appearance.ForeColor = isCapturing ? Color.Black : Color.DarkRed;
+ }
+
+ private void btnClear_Click(object sender, EventArgs e)
+ {
+ packetTable?.Rows.Clear();
+ packetIndex = 0;
+ txCount = 0;
+ rxCount = 0;
+ lblStatus.Text = "Total: 0 | TX: 0 | RX: 0";
+ txtDetail.Text = string.Empty;
+ }
+
+ private void cmbFilter_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ ApplyFilter();
+ }
+
+ private void ApplyFilter()
+ {
+ if (packetTable == null) return;
+
+ string selected = cmbFilter.Text;
+ DataView dv = packetTable.DefaultView;
+
+ if (selected == "TX Only")
+ {
+ dv.RowFilter = "dir = 'TX'";
+ }
+ else if (selected == "RX Only")
+ {
+ dv.RowFilter = "dir = 'RX'";
+ }
+ else if (selected == "Error Only")
+ {
+ dv.RowFilter = "crc = 'ERR'";
+ }
+ else
+ {
+ dv.RowFilter = string.Empty;
+ }
+ }
+
+ private void btnExport_Click(object sender, EventArgs e)
+ {
+ if (packetTable == null || packetTable.Rows.Count == 0)
+ {
+ MessageBox.Show("No packet logs to export.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ return;
+ }
+
+ SaveFileDialog sDialog = new SaveFileDialog();
+ sDialog.Title = "Export Packet Logs";
+ sDialog.DefaultExt = "xls";
+ sDialog.Filter = "Excel files (*.xls)|*.xls|All files (*.*)|*.*";
+
+ if (sDialog.ShowDialog() == DialogResult.OK)
+ {
+ try
+ {
+ DataTable exportTable = packetTable.DefaultView.ToTable(false, "no", "time", "dir", "dev_id", "func", "len", "hex", "desc", "crc");
+ csExcelExport.ExportToExcelExt(exportTable, sDialog.FileName);
+ MessageBox.Show("Complete Exporting Packet Log File.", "Result", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+ }
+
+ private void fmxPacketLog_FormClosing(object sender, FormClosingEventArgs e)
+ {
+ // Just hide on close so it can be re-opened quickly
+ if (e.CloseReason == CloseReason.UserClosing)
+ {
+ e.Cancel = true;
+ this.Hide();
+ }
+ }
+ }
+}
diff --git a/LFP_Manager/Forms/fmxPacketLog.resx b/LFP_Manager/Forms/fmxPacketLog.resx
new file mode 100644
index 0000000..459ff73
--- /dev/null
+++ b/LFP_Manager/Forms/fmxPacketLog.resx
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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
+
+
diff --git a/LFP_Manager/Function/csSerialCommFunction.cs b/LFP_Manager/Function/csSerialCommFunction.cs
index 82ea7f7..01cc99a 100644
--- a/LFP_Manager/Function/csSerialCommFunction.cs
+++ b/LFP_Manager/Function/csSerialCommFunction.cs
@@ -758,6 +758,9 @@ namespace LFP_Manager.Function
case 137: // Anti-Theft Gyro-Scope
rSystemData.CalibriationData.AntiTheft.GyroScope = reg_value;
break;
+ case 138: // Anti-Theft Activated Status
+ rSystemData.CalibriationData.AntiTheft.Status = reg_value;
+ break;
}
}
diff --git a/LFP_Manager/LFP_Manager.zip b/LFP_Manager/LFP_Manager.zip
deleted file mode 100644
index f2f4fc4..0000000
Binary files a/LFP_Manager/LFP_Manager.zip and /dev/null differ
diff --git a/LFP_Manager/LFP_Manager_GL.csproj b/LFP_Manager/LFP_Manager_GL.csproj
deleted file mode 100644
index 00d107c..0000000
--- a/LFP_Manager/LFP_Manager_GL.csproj
+++ /dev/null
@@ -1,530 +0,0 @@
-
-
-
-
- Debug
- AnyCPU
- 9.0.21022
- 2.0
- {BE0785A4-0CCB-44C5-A8C0-1AA2245E71F4}
- WinExe
- Properties
- LFP_Manager
- LFP_Manager_GL
- v4.5.2
- 512
-
-
- 3.5
-
-
-
-
-
-
-
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
- true
- x86
- false
-
-
- pdbonly
- false
- bin\Release\
- DEBUG;TRACE
- prompt
- 4
- true
- x86
- false
-
-
- Resources\AMO_LOGO.ico
-
-
-
-
- True
-
-
- True
-
-
- True
-
-
-
-
- True
-
-
- True
-
-
- True
-
-
- True
-
-
- True
-
-
- True
-
-
-
-
- True
-
-
-
- True
-
-
- True
-
-
- True
-
-
- True
-
-
- True
-
-
-
- True
-
-
- True
-
-
-
- True
-
-
-
- True
-
-
-
-
-
- ..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll
-
-
- ..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.SqlServer.dll
-
-
- dll\IPAddressControlLib.dll
-
-
- dll\log4net.dll
-
-
- False
- dll\SnmpSharpNet.dll
-
-
-
-
-
- 3.5
-
-
-
- ..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.113.3\lib\net451\System.Data.SQLite.dll
-
-
- ..\packages\System.Data.SQLite.EF6.1.0.113.0\lib\net451\System.Data.SQLite.EF6.dll
-
-
- ..\packages\System.Data.SQLite.Linq.1.0.113.0\lib\net451\System.Data.SQLite.Linq.dll
-
-
-
-
-
-
-
-
- 3.5
-
-
- 3.5
-
-
-
-
-
-
-
- dll\Tftp.Net.dll
-
-
-
-
- UserControl
-
-
- ucCalibration.cs
-
-
- UserControl
-
-
- ucCalibrationView.cs
-
-
- UserControl
-
-
- ucCommConfig.cs
-
-
- UserControl
-
-
- ucDataLog.cs
-
-
- UserControl
-
-
- ucEtcStatusView.cs
-
-
- UserControl
-
-
- ucEventLog.cs
-
-
- UserControl
-
-
- ucHistroy.cs
-
-
- UserControl
-
-
- ucMainStatus.cs
-
-
- UserControl
-
-
- ucModuleMainB.cs
-
-
- UserControl
-
-
- ucParamSet.cs
-
-
- UserControl
-
-
- ucShelfStatus.cs
-
-
- UserControl
-
-
- ucStatus.cs
-
-
- UserControl
-
-
- ucTargetControl.cs
-
-
- UserControl
-
-
- ucTftpClientcs.cs
-
-
- UserControl
-
-
- ucModuleMainA.cs
-
-
-
-
- Form
-
-
- fmxEtcStatus.cs
-
-
- Form
-
-
- fmxExcelFile.cs
-
-
- Form
-
-
- fmxFwImageConverter.cs
-
-
- Form
-
-
- fmxCalibration.cs
-
-
- Form
-
-
- fmxFwUpdate.cs
-
-
- Form
-
-
- fmxFwUpdateTftp.cs
-
-
- Form
-
-
- fmxHistory.cs
-
-
- Form
-
-
- fmxInventoryConfig.cs
-
-
- Form
-
-
- fmxModuleDetail.cs
-
-
- Form
-
-
- fmxParamConfig.cs
-
-
- Form
-
-
- fmxSystemSet.cs
-
-
- Form
-
-
- fmxWait.cs
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Form
-
-
- fmxCommConfig.cs
-
-
- Form
-
-
- fmxMain.cs
-
-
-
-
-
-
-
-
-
-
-
-
-
- ucCalibration.cs
-
-
- ucCalibrationView.cs
-
-
- ucCommConfig.cs
-
-
- ucDataLog.cs
-
-
- ucEtcStatusView.cs
-
-
- ucEventLog.cs
-
-
- ucHistroy.cs
-
-
- ucMainStatus.cs
-
-
- ucModuleMainA.cs
-
-
- ucModuleMainB.cs
-
-
- ucParamSet.cs
-
-
- ucShelfStatus.cs
-
-
- ucStatus.cs
-
-
- ucTargetControl.cs
-
-
- ucTftpClientcs.cs
-
-
- fmxEtcStatus.cs
-
-
- fmxExcelFile.cs
-
-
- fmxFwImageConverter.cs
-
-
- fmxCalibration.cs
-
-
- fmxCommConfig.cs
-
-
- fmxFwUpdate.cs
-
-
- fmxFwUpdateTftp.cs
-
-
- fmxHistory.cs
-
-
- fmxInventoryConfig.cs
-
-
- fmxMain.cs
-
-
- fmxModuleDetail.cs
-
-
- fmxParamConfig.cs
-
-
- fmxSystemSet.cs
-
-
- fmxWait.cs
-
-
-
- ResXFileCodeGenerator
- Resources.Designer.cs
- Designer
-
-
- True
- Resources.resx
- True
-
-
-
-
- SettingsSingleFileGenerator
- Settings.Designer.cs
-
-
- True
- Settings.settings
- True
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- if not exist "$(TargetDir)\Library" mkdir "$(TargetDir)\Library"
-if not exist "$(TargetDir)\Library\kerneldlls" mkdir "$(TargetDir)\Library\kerneldlls"
-move "$(TargetDir)\*.dll" "$(TargetDir)\Library"
-move "$(TargetDir)\*.pdb" "$(TargetDir)\Library"
-move "$(TargetDir)\*.xml" "$(TargetDir)\Library"
-copy "$(ProjectDir)\dll\*.dll" "$(TargetDir)\Library"
-copy "$(ProjectDir)\dll\kerneldlls\*.*" "$(TargetDir)\Library\kerneldlls"
-
-if not exist "$(TargetDir)\sql" mkdir "$(TargetDir)\sql"
-copy "$(ProjectDir)\DB Schema\*.sql" "$(TargetDir)\sql"
-
-
- if exist "$(TargetDir)\library" rmdir /s /q "$(TargetDir)\library"
-if exist "$(TargetDir)\sql" rmdir /s /q "$(TargetDir)\sql"
-
-
-
- 이 프로젝트는 이 컴퓨터에 없는 NuGet 패키지를 참조합니다. 해당 패키지를 다운로드하려면 NuGet 패키지 복원을 사용하십시오. 자세한 내용은 http://go.microsoft.com/fwlink/?LinkID=322105를 참조하십시오. 누락된 파일은 {0}입니다.
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/LFP_Manager/LFP_Manager_GL.csproj.bak b/LFP_Manager/LFP_Manager_GL.csproj.bak
deleted file mode 100644
index ea0297e..0000000
--- a/LFP_Manager/LFP_Manager_GL.csproj.bak
+++ /dev/null
@@ -1,526 +0,0 @@
-
-
-
-
- Debug
- AnyCPU
- 9.0.21022
- 2.0
- {BE0785A4-0CCB-44C5-A8C0-1AA2245E71F4}
- WinExe
- Properties
- LFP_Manager
- LFP_Manager_GL
- v4.5.2
- 512
-
-
- 3.5
-
-
-
-
-
-
-
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
- true
- x86
- false
-
-
- pdbonly
- false
- bin\Release\
- DEBUG;TRACE
- prompt
- 4
- true
- x86
- false
-
-
- Resources\AMO_LOGO.ico
-
-
-
-
- True
-
-
- True
-
-
-
-
- True
-
-
- True
-
-
- True
-
-
- True
-
-
- True
-
-
- True
-
-
-
-
- True
-
-
-
- True
-
-
- True
-
-
- True
-
-
- True
-
-
- True
-
-
-
- True
-
-
- True
-
-
-
- True
-
-
-
- True
-
-
-
-
- ..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll
-
-
- ..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.SqlServer.dll
-
-
- dll\IPAddressControlLib.dll
-
-
- dll\log4net.dll
-
-
- False
- dll\SnmpSharpNet.dll
-
-
-
-
-
- 3.5
-
-
-
- ..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.113.3\lib\net451\System.Data.SQLite.dll
-
-
- ..\packages\System.Data.SQLite.EF6.1.0.113.0\lib\net451\System.Data.SQLite.EF6.dll
-
-
- ..\packages\System.Data.SQLite.Linq.1.0.113.0\lib\net451\System.Data.SQLite.Linq.dll
-
-
-
-
-
-
-
-
- 3.5
-
-
- 3.5
-
-
-
-
-
-
-
- dll\Tftp.Net.dll
-
-
-
-
- UserControl
-
-
- ucCalibration.cs
-
-
- UserControl
-
-
- ucCalibrationView.cs
-
-
- UserControl
-
-
- ucCommConfig.cs
-
-
- UserControl
-
-
- ucDataLog.cs
-
-
- UserControl
-
-
- ucEtcStatusView.cs
-
-
- UserControl
-
-
- ucEventLog.cs
-
-
- UserControl
-
-
- ucHistroy.cs
-
-
- UserControl
-
-
- ucMainStatus.cs
-
-
- UserControl
-
-
- ucModuleMainB.cs
-
-
- UserControl
-
-
- ucParamSet.cs
-
-
- UserControl
-
-
- ucShelfStatus.cs
-
-
- UserControl
-
-
- ucStatus.cs
-
-
- UserControl
-
-
- ucTargetControl.cs
-
-
- UserControl
-
-
- ucTftpClientcs.cs
-
-
- UserControl
-
-
- ucModuleMainA.cs
-
-
-
-
- Form
-
-
- fmxEtcStatus.cs
-
-
- Form
-
-
- fmxExcelFile.cs
-
-
- Form
-
-
- fmxFwImageConverter.cs
-
-
- Form
-
-
- fmxCalibration.cs
-
-
- Form
-
-
- fmxFwUpdate.cs
-
-
- Form
-
-
- fmxFwUpdateTftp.cs
-
-
- Form
-
-
- fmxHistory.cs
-
-
- Form
-
-
- fmxInventoryConfig.cs
-
-
- Form
-
-
- fmxModuleDetail.cs
-
-
- Form
-
-
- fmxParamConfig.cs
-
-
- Form
-
-
- fmxSystemSet.cs
-
-
- Form
-
-
- fmxWait.cs
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Form
-
-
- fmxCommConfig.cs
-
-
- Form
-
-
- fmxMain.cs
-
-
-
-
-
-
-
-
-
-
-
-
-
- ucCalibration.cs
-
-
- ucCalibrationView.cs
-
-
- ucCommConfig.cs
-
-
- ucDataLog.cs
-
-
- ucEtcStatusView.cs
-
-
- ucEventLog.cs
-
-
- ucHistroy.cs
-
-
- ucMainStatus.cs
-
-
- ucModuleMainA.cs
-
-
- ucModuleMainB.cs
-
-
- ucParamSet.cs
-
-
- ucShelfStatus.cs
-
-
- ucStatus.cs
-
-
- ucTargetControl.cs
-
-
- ucTftpClientcs.cs
-
-
- fmxEtcStatus.cs
-
-
- fmxExcelFile.cs
-
-
- fmxFwImageConverter.cs
-
-
- fmxCalibration.cs
-
-
- fmxCommConfig.cs
-
-
- fmxFwUpdate.cs
-
-
- fmxFwUpdateTftp.cs
-
-
- fmxHistory.cs
-
-
- fmxInventoryConfig.cs
-
-
- fmxMain.cs
-
-
- fmxModuleDetail.cs
-
-
- fmxParamConfig.cs
-
-
- fmxSystemSet.cs
-
-
- fmxWait.cs
-
-
-
- ResXFileCodeGenerator
- Resources.Designer.cs
- Designer
-
-
- True
- Resources.resx
- True
-
-
-
-
- SettingsSingleFileGenerator
- Settings.Designer.cs
-
-
- True
- Settings.settings
- True
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- if not exist "$(TargetDir)\Library" mkdir "$(TargetDir)\Library"
-if not exist "$(TargetDir)\Library\kerneldlls" mkdir "$(TargetDir)\Library\kerneldlls"
-move "$(TargetDir)\*.dll" "$(TargetDir)\Library"
-move "$(TargetDir)\*.pdb" "$(TargetDir)\Library"
-move "$(TargetDir)\*.xml" "$(TargetDir)\Library"
-copy "$(ProjectDir)\dll\*.dll" "$(TargetDir)\Library"
-copy "$(ProjectDir)\dll\kerneldlls\*.*" "$(TargetDir)\Library\kerneldlls"
-
-if not exist "$(TargetDir)\sql" mkdir "$(TargetDir)\sql"
-copy "$(ProjectDir)\DB Schema\*.sql" "$(TargetDir)\sql"
-
-
- if exist "$(TargetDir)\library" rmdir /s /q "$(TargetDir)\library"
-if exist "$(TargetDir)\sql" rmdir /s /q "$(TargetDir)\sql"
-
-
-
- 이 프로젝트는 이 컴퓨터에 없는 NuGet 패키지를 참조합니다. 해당 패키지를 다운로드하려면 NuGet 패키지 복원을 사용하십시오. 자세한 내용은 http://go.microsoft.com/fwlink/?LinkID=322105를 참조하십시오. 누락된 파일은 {0}입니다.
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/LFP_Manager/LFP_Manager_JP.csproj.bak b/LFP_Manager/LFP_Manager_JP.csproj.bak
deleted file mode 100644
index ed92028..0000000
--- a/LFP_Manager/LFP_Manager_JP.csproj.bak
+++ /dev/null
@@ -1,411 +0,0 @@
-
-
-
- Debug
- AnyCPU
- 9.0.21022
- 2.0
- {BE0785A4-0CCB-44C5-A8C0-1AA2245E71F4}
- WinExe
- Properties
- LFP_Manager
- LFP_Manager_JP
- v4.5.2
- 512
-
-
- 3.5
-
-
-
-
-
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
- true
- x86
- false
-
-
- pdbonly
- false
- bin\Release\
- DEBUG;TRACE
- prompt
- 4
- true
- x86
- false
-
-
- Resources\AMO_LOGO.ico
-
-
-
- True
-
-
- True
-
-
- True
-
-
- True
-
-
-
- True
-
-
- True
-
-
- True
-
-
- True
-
-
- True
-
-
- True
-
-
- True
-
-
-
- True
-
-
-
- True
-
-
- dll\IPAddressControlLib.dll
-
-
- dll\log4net.dll
-
-
- False
- dll\SnmpSharpNet.dll
-
-
-
-
- 3.5
-
-
- False
- dll\System.Data.SQLite.dll
-
-
-
-
-
- 3.5
-
-
- 3.5
-
-
-
-
-
-
-
- dll\Tftp.Net.dll
-
-
-
-
- UserControl
-
-
- ucCalibration.cs
-
-
- UserControl
-
-
- ucCommConfig.cs
-
-
- UserControl
-
-
- ucDataLog.cs
-
-
- UserControl
-
-
- ucEventLog.cs
-
-
- UserControl
-
-
- ucHistroy.cs
-
-
- UserControl
-
-
- ucMainStatus.cs
-
-
- UserControl
-
-
- ucParamSet.cs
-
-
- UserControl
-
-
- ucShelfStatus.cs
-
-
- UserControl
-
-
- ucStatus.cs
-
-
- UserControl
-
-
- ucTargetControl.cs
-
-
- UserControl
-
-
- ucTftpClientcs.cs
-
-
-
-
- Form
-
-
- fmxExcelFile.cs
-
-
- Form
-
-
- fmxFwImageConverter.cs
-
-
- Form
-
-
- fmxCalibration.cs
-
-
- Form
-
-
- fmxFwUpdate.cs
-
-
- Form
-
-
- fmxFwUpdateTftp.cs
-
-
- Form
-
-
- fmxHistorycs.cs
-
-
- Form
-
-
- fmxInventoryConfig.cs
-
-
- Form
-
-
- fmxParamConfig.cs
-
-
- Form
-
-
- fmxSystemSet.cs
-
-
- Form
-
-
- fmxWait.cs
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Form
-
-
- fmxCommConfig.cs
-
-
- Form
-
-
- fmxMain.cs
-
-
-
-
-
-
-
-
-
-
-
-
- ucCalibration.cs
-
-
- ucCommConfig.cs
-
-
- ucDataLog.cs
-
-
- ucEventLog.cs
-
-
- ucHistroy.cs
-
-
- ucMainStatus.cs
-
-
- ucParamSet.cs
-
-
- ucShelfStatus.cs
-
-
- ucStatus.cs
-
-
- ucTargetControl.cs
-
-
- ucTftpClientcs.cs
-
-
- fmxExcelFile.cs
-
-
- fmxFwImageConverter.cs
-
-
- fmxCalibration.cs
-
-
- fmxCommConfig.cs
-
-
- fmxFwUpdate.cs
-
-
- fmxFwUpdateTftp.cs
-
-
- fmxHistorycs.cs
-
-
- fmxInventoryConfig.cs
-
-
- fmxMain.cs
-
-
- fmxParamConfig.cs
-
-
- fmxSystemSet.cs
-
-
- fmxWait.cs
-
-
-
- ResXFileCodeGenerator
- Resources.Designer.cs
- Designer
-
-
- True
- Resources.resx
- True
-
-
-
- SettingsSingleFileGenerator
- Settings.Designer.cs
-
-
- True
- Settings.settings
- True
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- if not exist "$(TargetDir)\Library" mkdir "$(TargetDir)\Library"
-move "$(TargetDir)\*.dll" "$(TargetDir)\Library"
-move "$(TargetDir)\*.pdb" "$(TargetDir)\Library"
-move "$(TargetDir)\*.xml" "$(TargetDir)\Library"
-
-
- if not exist "$(TargetDir)\sql" mkdir "$(TargetDir)\sql"
-copy "$(ProjectDir)\DB Schema\*.sql" "$(TargetDir)\sql"
-
-
-
\ No newline at end of file
diff --git a/LFP_Manager/LFP_Manager_M20.csproj.bak b/LFP_Manager/LFP_Manager_M20.csproj.bak
deleted file mode 100644
index 4641307..0000000
--- a/LFP_Manager/LFP_Manager_M20.csproj.bak
+++ /dev/null
@@ -1,508 +0,0 @@
-
-
-
-
- Debug
- AnyCPU
- 9.0.21022
- 2.0
- {BE0785A4-0CCB-44C5-A8C0-1AA2245E71F4}
- WinExe
- Properties
- LFP_Manager
- LFP_Manager_M20
- v4.8
- 512
-
-
- 3.5
-
-
-
-
-
-
-
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
- true
- x86
- false
-
-
- pdbonly
- false
- bin\Release\
- DEBUG;TRACE
- prompt
- 4
- true
- x86
- false
-
-
- Resources\AMO_LOGO.ico
-
-
-
-
- True
-
-
- True
-
-
-
-
- True
-
-
- True
-
-
- True
-
-
- True
-
-
- True
-
-
- True
-
-
-
-
- True
-
-
-
- True
-
-
- True
-
-
- True
-
-
- True
-
-
- True
-
-
-
- True
-
-
- True
-
-
-
- True
-
-
-
- True
-
-
-
-
- ..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll
-
-
- ..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.SqlServer.dll
-
-
- dll\IPAddressControlLib.dll
-
-
- dll\log4net.dll
-
-
- False
- dll\SnmpSharpNet.dll
-
-
-
-
-
- 3.5
-
-
-
- ..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.113.3\lib\net451\System.Data.SQLite.dll
-
-
- ..\packages\System.Data.SQLite.EF6.1.0.113.0\lib\net451\System.Data.SQLite.EF6.dll
-
-
- ..\packages\System.Data.SQLite.Linq.1.0.113.0\lib\net451\System.Data.SQLite.Linq.dll
-
-
-
-
-
-
-
-
- 3.5
-
-
- 3.5
-
-
-
-
-
-
-
- dll\Tftp.Net.dll
-
-
-
-
- UserControl
-
-
- ucCalibration.cs
-
-
- UserControl
-
-
- ucCalibrationView.cs
-
-
- UserControl
-
-
- ucCommConfig.cs
-
-
- UserControl
-
-
- ucDataLog.cs
-
-
- UserControl
-
-
- ucEventLog.cs
-
-
- UserControl
-
-
- ucHistroy.cs
-
-
- UserControl
-
-
- ucMainStatus.cs
-
-
- UserControl
-
-
- ucModuleMainB.cs
-
-
- UserControl
-
-
- ucParamSet.cs
-
-
- UserControl
-
-
- ucShelfStatus.cs
-
-
- UserControl
-
-
- ucStatus.cs
-
-
- UserControl
-
-
- ucTargetControl.cs
-
-
- UserControl
-
-
- ucTftpClientcs.cs
-
-
- UserControl
-
-
- ucModuleMainA.cs
-
-
-
-
- Form
-
-
- fmxExcelFile.cs
-
-
- Form
-
-
- fmxFwImageConverter.cs
-
-
- Form
-
-
- fmxCalibration.cs
-
-
- Form
-
-
- fmxFwUpdate.cs
-
-
- Form
-
-
- fmxFwUpdateTftp.cs
-
-
- Form
-
-
- fmxHistory.cs
-
-
- Form
-
-
- fmxInventoryConfig.cs
-
-
- Form
-
-
- fmxModuleDetail.cs
-
-
- Form
-
-
- fmxParamConfig.cs
-
-
- Form
-
-
- fmxSystemSet.cs
-
-
- Form
-
-
- fmxWait.cs
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Form
-
-
- fmxCommConfig.cs
-
-
- Form
-
-
- fmxMain.cs
-
-
-
-
-
-
-
-
-
-
-
-
-
- ucCalibration.cs
-
-
- ucCalibrationView.cs
-
-
- ucCommConfig.cs
-
-
- ucDataLog.cs
-
-
- ucEventLog.cs
-
-
- ucHistroy.cs
-
-
- ucMainStatus.cs
-
-
- ucModuleMainA.cs
-
-
- ucModuleMainB.cs
-
-
- ucParamSet.cs
-
-
- ucShelfStatus.cs
-
-
- ucStatus.cs
-
-
- ucTargetControl.cs
-
-
- ucTftpClientcs.cs
-
-
- fmxExcelFile.cs
-
-
- fmxFwImageConverter.cs
-
-
- fmxCalibration.cs
-
-
- fmxCommConfig.cs
-
-
- fmxFwUpdate.cs
-
-
- fmxFwUpdateTftp.cs
-
-
- fmxHistory.cs
-
-
- fmxInventoryConfig.cs
-
-
- fmxMain.cs
-
-
- fmxModuleDetail.cs
-
-
- fmxParamConfig.cs
-
-
- fmxSystemSet.cs
-
-
- fmxWait.cs
-
-
-
- ResXFileCodeGenerator
- Resources.Designer.cs
- Designer
-
-
- True
- Resources.resx
- True
-
-
-
-
- SettingsSingleFileGenerator
- Settings.Designer.cs
-
-
- True
- Settings.settings
- True
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- if not exist "$(TargetDir)\Library" mkdir "$(TargetDir)\Library"
-if not exist "$(TargetDir)\Library\kerneldlls" mkdir "$(TargetDir)\Library\kerneldlls"
-move "$(TargetDir)\*.dll" "$(TargetDir)\Library"
-move "$(TargetDir)\*.pdb" "$(TargetDir)\Library"
-move "$(TargetDir)\*.xml" "$(TargetDir)\Library"
-copy "$(ProjectDir)\dll\*.dll" "$(TargetDir)\Library"
-copy "$(ProjectDir)\dll\kerneldlls\*.*" "$(TargetDir)\Library\kerneldlls"
-
-if not exist "$(TargetDir)\sql" mkdir "$(TargetDir)\sql"
-copy "$(ProjectDir)\DB Schema\*.sql" "$(TargetDir)\sql"
-
-
- if exist "$(TargetDir)\library" rmdir /s /q "$(TargetDir)\library"
-if exist "$(TargetDir)\sql" rmdir /s /q "$(TargetDir)\sql"
-
-
-
- 이 프로젝트는 이 컴퓨터에 없는 NuGet 패키지를 참조합니다. 해당 패키지를 다운로드하려면 NuGet 패키지 복원을 사용하십시오. 자세한 내용은 http://go.microsoft.com/fwlink/?LinkID=322105를 참조하십시오. 누락된 파일은 {0}입니다.
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/LFP_Manager/LFP_Manager_TW_DBG.csproj b/LFP_Manager/LFP_Manager_TW_DBG.csproj
index 4d3e056..d36cf50 100644
--- a/LFP_Manager/LFP_Manager_TW_DBG.csproj
+++ b/LFP_Manager/LFP_Manager_TW_DBG.csproj
@@ -289,6 +289,12 @@
fmxHistory.cs
+
+ Form
+
+
+ fmxPacketLog.cs
+
Form
@@ -416,6 +422,9 @@
fmxHistory.cs
+
+ fmxPacketLog.cs
+
fmxInventoryConfig.cs
diff --git a/LFP_Manager/Properties/AssemblyInfo.cs b/LFP_Manager/Properties/AssemblyInfo.cs
index d5e6483..37d5ecd 100644
--- a/LFP_Manager/Properties/AssemblyInfo.cs
+++ b/LFP_Manager/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.1.1.0")]
-[assembly: AssemblyFileVersion("1.1.1.0")]
+[assembly: AssemblyVersion("1.1.1.1")]
+[assembly: AssemblyFileVersion("1.1.1.1")]
diff --git a/LFP_Manager/Threads/csUartThread.cs b/LFP_Manager/Threads/csUartThread.cs
index 24cde53..3053009 100644
--- a/LFP_Manager/Threads/csUartThread.cs
+++ b/LFP_Manager/Threads/csUartThread.cs
@@ -1,7 +1,7 @@
using System;
-
-using System.Threading;
+using System.Collections.Concurrent;
using System.IO.Ports;
+using System.Threading;
using System.Windows.Forms;
using LFP_Manager.DataStructure;
@@ -12,6 +12,7 @@ namespace LFP_Manager.Threads
public delegate void UartDataUpdate(object sender, ref DeviceSystemData aSystemData);
public delegate void UartDataRecv(byte[] data);
public delegate void UartDataPrint(object sender, string msg);
+ public delegate void UartPacketLogEvent(DateTime timestamp, bool isTx, byte[] packet, string description);
class csUartThread
{
@@ -28,23 +29,14 @@ namespace LFP_Manager.Threads
private bool AutoUartTx = true;
private int addr_ch = 0;
- private ushort RequestRegAddr = 0x0000; //Byul Init 0x0000
- private ushort RequestRegLen = 50;
- private bool rFlag = false;
- private int wFlag = 0;
- private ushort ReadRegAddr = 0x0000; //Byul Init 0x0000
- private ushort ReadRegLen = 0x0000; //Byul Init 0x0000
-
- private ushort WriteRegAddr = 0x0000; //Byul Init 0x0000
- private short WriteCoilRegData = 0;
- private byte[] WriteRegData;
-
- private TUartTxBuff uartTxBuff = null;
+ // Thread-Safe TX Queue
+ private readonly ConcurrentQueue txQueue = new ConcurrentQueue();
public event UartDataUpdate OnUpdate = null;
public event UartDataRecv OnDataRecv = null;
public event UartDataPrint OnPrint = null;
+ public event UartPacketLogEvent OnPacketLog = null;
#endregion
@@ -56,8 +48,6 @@ namespace LFP_Manager.Threads
Config = aConfig;
SystemData = aSystemData;
- uartTxBuff = new TUartTxBuff();
-
serialComm = new Thread(uartCommThread);
}
@@ -130,13 +120,10 @@ namespace LFP_Manager.Threads
private void sErrorReceived(object sender, System.IO.Ports.SerialErrorReceivedEventArgs e)
{
- //
- //csMakeDataFunction.SetData()
}
private void sPinChanged(object sender, System.IO.Ports.SerialPinChangedEventArgs e)
{
- //
}
private bool Open(string cPort, int cBaudrate)
@@ -174,7 +161,7 @@ namespace LFP_Manager.Threads
#endregion
- #region PUBLIC FUNCTION
+ #region PUBLIC TX FUNCTIONS (QUEUE BASED)
public void SetPolling(bool flag, int sId, ref DeviceSystemData aSystemData)
{
@@ -189,52 +176,66 @@ namespace LFP_Manager.Threads
AutoUartTx = autoTx;
}
- public void SetWriteCoilReg(ushort WriteAddr, short WriteData)
+ ///
+ /// 공통 TX 큐 삽입 메서드
+ ///
+ public void EnqueueTx(TUartTxItem item)
{
- wFlag = 2;
- WriteRegAddr = WriteAddr;
- WriteCoilRegData = WriteData;
-
- for (int i = 0; i < 500; i += 10)
+ if (item != null)
{
- Thread.Sleep(10);
- Application.DoEvents();
+ txQueue.Enqueue(item);
}
}
+ ///
+ /// 원시 패킷 전송 (FW 업데이트 등)
+ ///
+ public void SendRawPacket(byte[] rawData, bool expectReply = true)
+ {
+ if (rawData == null || rawData.Length == 0) return;
+ TUartTxItem item = new TUartTxItem(UartTxType.Raw, SystemId, 0, (ushort)rawData.Length, rawData, expectReply, Config.RecvWaitTime);
+ EnqueueTx(item);
+ }
+
+ ///
+ /// 코일 레지스터 쓰기 (TX 큐 삽입)
+ ///
+ public void SetWriteCoilReg(ushort WriteAddr, short WriteData)
+ {
+ byte[] data = csSerialCommFunction.MakeWriteCoilData((ushort)SystemId, WriteAddr, WriteData);
+ TUartTxItem item = new TUartTxItem(UartTxType.WriteCoil, SystemId, WriteAddr, 1, data, true, Config.RecvWaitTime);
+ EnqueueTx(item);
+ }
+
+ ///
+ /// 레지스터 쓰기 (TX 큐 삽입)
+ ///
public void SetWriteReg(ushort WriteAddr, byte[] WriteData, bool ReplyFlag)
{
- wFlag = 1;
-
- WriteRegAddr = WriteAddr;
-
- TUartTRxData uartTRxData = new TUartTRxData();
- uartTRxData.type = wFlag;
- //uartTRxData.data = csSerialCommFunction.MakeWriteRegisterData((ushort)SystemId, WriteRegAddr, WriteData);
- uartTRxData.data = WriteData;
- uartTRxData.length = uartTRxData.data.Length;
-
- uartTxBuff?.PutBuff(uartTRxData);
+ if (WriteData == null) return;
+ TUartTxItem item = new TUartTxItem(UartTxType.WriteReg, SystemId, WriteAddr, (ushort)WriteData.Length, WriteData, ReplyFlag, Config.RecvWaitTime);
+ EnqueueTx(item);
}
+
+ ///
+ /// 레지스터 읽기 (TX 큐 삽입)
+ ///
public void SetReadReg(ushort ReadAddr, ushort ReadLen, bool ReplyFlag)
{
- wFlag = 4;
- ReadRegAddr = ReadAddr;
- ReadRegLen = ReadLen;
+ byte[] data = csSerialCommFunction.MakeReadRegisterData((ushort)SystemId, csSerialCommFunction.READ_HOLDING_REG, ReadAddr, ReadLen);
+ TUartTxItem item = new TUartTxItem(UartTxType.ReadReg, SystemId, ReadAddr, ReadLen, data, ReplyFlag, Config.RecvWaitTime);
+ EnqueueTx(item);
}
+ ///
+ /// 파라미터 레지스터 쓰기 (TX 큐 삽입)
+ ///
public void SetParam(ushort WriteAddr, short[] WriteData)
{
- wFlag = 1;
-
- WriteRegAddr = WriteAddr;
-
- TUartTRxData uartTRxData = new TUartTRxData();
- uartTRxData.type = wFlag;
- uartTRxData.data = csSerialCommFunction.MakeWriteRegisterData((ushort)SystemId, WriteRegAddr, WriteData);
- uartTRxData.length = uartTRxData.data.Length;
-
- uartTxBuff?.PutBuff(uartTRxData);
+ if (WriteData == null) return;
+ byte[] data = csSerialCommFunction.MakeWriteRegisterData((ushort)SystemId, WriteAddr, WriteData);
+ TUartTxItem item = new TUartTxItem(UartTxType.WriteParam, SystemId, WriteAddr, (ushort)WriteData.Length, data, true, Config.RecvWaitTime);
+ EnqueueTx(item);
}
public void SendProcessFromApp(int sId, int mode, int index, int flag, ref DeviceParamData aParam, ref DeviceCalibration aCalib)
@@ -315,13 +316,8 @@ namespace LFP_Manager.Threads
break;
case csConstData.UART_PARAM_LIST.DEFAULT_PARAM: // Default Parameter
int i = 0;
-
- Forms.fmxWait WaitForm = new Forms.fmxWait();
- WaitForm.StartPosition = FormStartPosition.CenterScreen;
-
try
{
- //WaitForm.Show();
data = new short[1];
i = csConstData.UART_PARAM_LIST.CELL_UNDER_VOLTAGE;
@@ -385,10 +381,6 @@ namespace LFP_Manager.Threads
catch (Exception)
{
- }
- finally
- {
- //WaitForm?.Close();
}
break;
case 15: // Capcity change
@@ -413,16 +405,11 @@ namespace LFP_Manager.Threads
case 18:
data = new short[1];
i = csConstData.UART_CALIB_ADDR_LIST.ANTI_THEFT;
- //data[0] = (short)aCalib.AntiTheft.Comm; SetParam((ushort)(i + 0), data);
data[0] = (short)aCalib.AntiTheft.GyroScope; SetParam((ushort)(i + 1), data);
break;
case 19:
data = new short[1];
i = csConstData.UART_CALIB_ADDR_LIST.ANTI_THEFT;
- //data[0] = (short)0; SetParam((ushort)(i + 0), data);
- data[0] = (short)0; SetParam((ushort)(i + 1), data);
-
- //data[0] = (short)aCalib.AntiTheft.Comm; SetParam((ushort)(i + 0), data);
data[0] = (short)aCalib.AntiTheft.GyroScope; SetParam((ushort)(i + 1), data);
break;
default:
@@ -471,176 +458,84 @@ namespace LFP_Manager.Threads
#endregion
- #region TX BUFFERING
+ #region POLLING GENERATOR
- private byte[] MakeWriteRegData(ushort DevID, ushort WriteAddr, ushort WriteLen, ref ushort[] WriteData)
+ ///
+ /// 다음 주기 Polling 패킷 아이템 생성
+ ///
+ private TUartTxItem CreateNextPollingItem()
{
- byte[] wData = null;
+ ushort reqAddr = 0x0000;
+ ushort reqLen = 50;
+ ushort sCmd = csSerialCommFunction.READ_HOLDING_REG;
- if (WriteLen > 0)
+ switch (addr_ch)
{
-
- }
-
- return wData;
- }
-
- private string MakeCheckSum(byte[] sData, int len)
- {
- string result = "";
- int checksum = 0;
-
- for (int i = 0; i < len; i++)
- {
- checksum += sData[i + 1];
- }
-
- checksum = ~checksum + 1;
-
- result = String.Format("{0:X2}{1:X2}", (byte)(checksum >> 8), (byte)checksum);
-
- return result;
- }
-
- private byte[] MakeTxDataVision(ref bool wData)
- {
- byte[] sData = null;
-
- if ((uartTxBuff != null) && (uartTxBuff.CheckBuff()))
- {
- TUartTRxData sBuff = uartTxBuff.GetBuff();
- if (sBuff != null)
- {
- sData = sBuff.data;
- wData = true;
- rFlag = true;
- }
- }
- else if (wFlag == 2)
- {
- sData = csSerialCommFunction.MakeWriteCoilData((ushort)SystemId, WriteRegAddr, WriteCoilRegData);
- if (wFlag != 0) wFlag = 0;
- rFlag = true;
- }
- else if (wFlag == 3)
- {
- sData = WriteRegData;
- if (wFlag != 0) wFlag = 0;
- rFlag = true;
- }
- else if (wFlag == 4)
- {
- sData = csSerialCommFunction.MakeReadRegisterData((ushort)SystemId, csSerialCommFunction.READ_HOLDING_REG, ReadRegAddr, ReadRegLen);
- if (wFlag != 0) wFlag = 0;
- rFlag = true;
- }
- else
- {
- if (UartPolling && AutoUartTx)
- {
- ushort sCmd;
- switch (addr_ch)
- {
- case 0:
- addr_ch = 1;
- RequestRegAddr = 0x0000; //Byul Init 0x0000
- RequestRegLen = 0x0031;
- sCmd = csSerialCommFunction.READ_HOLDING_REG;
- rFlag = true;
- break;
- case 1:
- addr_ch = 4;
- RequestRegAddr = 58;
- RequestRegLen = 138-58;
- sCmd = csSerialCommFunction.READ_HOLDING_REG;
- rFlag = true;
- break;
- case 2:
- addr_ch = 3;
- RequestRegAddr = 0x3078;
- RequestRegLen = 8;
- sCmd = csSerialCommFunction.READ_COIL_STATUS;
- rFlag = true;
- break;
- case 3:
- addr_ch = 4;
- RequestRegAddr = 0x502E;
- RequestRegLen = 1;
- sCmd = csSerialCommFunction.READ_COIL_STATUS;
- rFlag = true;
- break;
- case 4:
- if (Config.ModuleQty > 1)
- {
- SystemId++;
- if (SystemId > Config.ModuleQty)
- {
- SystemId = 1;
- }
- }
- addr_ch = 0;
- sCmd = csSerialCommFunction.NO_CMD;
- rFlag = false;
- break;
- default:
- addr_ch = 0;
- RequestRegAddr = 0x0000; //Byul Init 0x0000
- RequestRegLen = 100;
- sCmd = csSerialCommFunction.READ_HOLDING_REG;
- break;
- }
- if (sCmd == csSerialCommFunction.NO_CMD)
- {
- sData = null;
- }
- else
- {
- sData = csSerialCommFunction.MakeReadRegisterData((ushort)SystemId, sCmd, RequestRegAddr, RequestRegLen);
- }
- }
- }
- return sData;
- }
-
- private byte ReqCmd = 0x42;
- private byte RequstedCmd;
-
- private byte[] TxProcess()
- {
- byte[] result = null;
-
- switch (ReqCmd)
- {
- case 0x42: // Get the number of PACK
- csSerialCommFunction.MakeTxData(0x01, ReqCmd, 2);
- RequstedCmd = ReqCmd;
- ReqCmd = 0x46;
+ case 0:
+ addr_ch = 1;
+ reqAddr = 0x0000;
+ reqLen = 0x0031; // 49
+ sCmd = csSerialCommFunction.READ_HOLDING_REG;
break;
- case 0x46: // Ger the analog information
- csSerialCommFunction.MakeTxData(0x01, ReqCmd, 2);
- RequstedCmd = ReqCmd;
- ReqCmd = 0x46;
+ case 1:
+ addr_ch = 4;
+ reqAddr = 58;
+ reqLen = 139 - 58; // 81 (Registers 58 ~ 138)
+ sCmd = csSerialCommFunction.READ_HOLDING_REG;
break;
- case 0x90: // Ger warning information
- csSerialCommFunction.MakeTxData(0x01, ReqCmd, 2);
- RequstedCmd = ReqCmd;
- ReqCmd = 0x46;
+ case 2:
+ addr_ch = 3;
+ reqAddr = 0x3078;
+ reqLen = 8;
+ sCmd = csSerialCommFunction.READ_COIL_STATUS;
+ break;
+ case 3:
+ addr_ch = 4;
+ reqAddr = 0x502E;
+ reqLen = 1;
+ sCmd = csSerialCommFunction.READ_COIL_STATUS;
+ break;
+ case 4:
+ if (Config.ModuleQty > 1)
+ {
+ SystemId++;
+ if (SystemId > Config.ModuleQty)
+ {
+ SystemId = 1;
+ }
+ }
+ addr_ch = 0;
+ sCmd = csSerialCommFunction.NO_CMD;
break;
default:
- ReqCmd = 0x42;
+ addr_ch = 0;
+ reqAddr = 0x0000;
+ reqLen = 100;
+ sCmd = csSerialCommFunction.READ_HOLDING_REG;
break;
}
- return result;
+ if (sCmd == csSerialCommFunction.NO_CMD)
+ {
+ return null;
+ }
+
+ byte[] sData = csSerialCommFunction.MakeReadRegisterData((ushort)SystemId, sCmd, reqAddr, reqLen);
+ if (sData == null || sData.Length == 0)
+ {
+ return null;
+ }
+
+ return new TUartTxItem(UartTxType.Polling, SystemId, reqAddr, reqLen, sData, true, Config.RecvWaitTime);
}
#endregion
- #region COMM THREAD
+ #region COMM THREAD (QUEUE BASED PIPELINE)
private readonly byte[] ReadBuf = new byte[BUFFER_SIZE];
- ushort rPosition = 0;
- bool BuffStart = false;
+ private ushort rPosition = 0;
+ private bool BuffStart = false;
private void RecvPacketInit()
{
@@ -650,153 +545,180 @@ namespace LFP_Manager.Threads
private void uartCommThread()
{
- int RecvTimeout = Config.RecvWaitTime;
int getData = 0;
byte cData = 0;
int TimeOutCount = 0;
- StartSend:
while (SerialPortThreadEnd == false)
{
- if ((sPort == null) || (sPort.IsOpen == false)) continue;
-
- //if (UartPolling)
- if (true)
+ if ((sPort == null) || (sPort.IsOpen == false))
{
- bool wMode = false;
- byte[] txData = MakeTxDataVision(ref wMode);
- if (sPort == null) return;
- if (txData != null)
+ Thread.Sleep(50);
+ continue;
+ }
+
+ // 1. 큐가 비어있고 Polling이 활성화되어 있을 때 다음 Polling 패킷을 TX 큐에 삽입
+ if (txQueue.IsEmpty && UartPolling && AutoUartTx)
+ {
+ TUartTxItem pollItem = CreateNextPollingItem();
+ if (pollItem != null)
{
- FlushBuff();
- sPort.Write(txData, 0, txData.Length);
+ txQueue.Enqueue(pollItem);
}
-
- if (rFlag == true)
+ else
{
- int rTimeOut = RecvTimeout;
- RecvPacketInit();
+ Thread.Sleep(10);
+ continue;
+ }
+ }
- while (rTimeOut > 0)
+ // 2. TX 큐에서 패킷 1개 꺼내기
+ if (!txQueue.TryDequeue(out TUartTxItem currentTx) || currentTx == null || currentTx.Data == null || currentTx.Data.Length == 0)
+ {
+ Thread.Sleep(20);
+ continue;
+ }
+
+ // 3. SerialPort로 패킷 전송
+ try
+ {
+ FlushBuff();
+ sPort.Write(currentTx.Data, 0, currentTx.Data.Length);
+ OnPacketLog?.Invoke(DateTime.Now, true, currentTx.Data, GetTxDescription(currentTx));
+ }
+ catch (Exception)
+ {
+ Thread.Sleep(50);
+ continue;
+ }
+
+ // 4. 응답 대기 및 수신 처리
+ if (currentTx.ExpectReply)
+ {
+ int rTimeOut = currentTx.TimeoutMs > 0 ? currentTx.TimeoutMs : Config.RecvWaitTime;
+ RecvPacketInit();
+ bool packetHandled = false;
+
+ while (rTimeOut > 0 && SerialPortThreadEnd == false)
+ {
+ if (((getData = GetBuff()) & 0x0100) != 0x0000)
{
- if (((getData = GetBuff()) & 0x0100) != 0x0000)
+ rTimeOut = currentTx.TimeoutMs > 0 ? currentTx.TimeoutMs : Config.RecvWaitTime;
+ cData = (byte)(getData & 0x00FF);
+
+ if (rPosition >= BUFFER_SIZE) RecvPacketInit();
+
+ if (BuffStart == false)
{
- rTimeOut = RecvTimeout;
-
- cData = (byte)(getData & 0x00FF);
-
- if (rPosition >= BUFFER_SIZE) RecvPacketInit();
-
- if (BuffStart == false)
- {
- if ((cData == (byte)SystemId) || (cData == (byte)0x7F))
- {
- rPosition = 0;
- ReadBuf[rPosition++] = cData;
- BuffStart = true;
- }
- }
- else
+ if ((cData == (byte)currentTx.SystemId) || (cData == (byte)0x7F) || (cData == (byte)SystemId))
{
+ rPosition = 0;
ReadBuf[rPosition++] = cData;
-
- switch (csSerialCommFunction.ModbusPacketFromSlaveCheck(ReadBuf, rPosition))
- {
- case 0: // Need more data
- break;
- case 1: // Packet OK, no error
- TimeOutCount = 0;
-
- int mID = ReadBuf[0];
- if (mID > 0) mID--;
-
- SystemData.CommFail = false;
- SystemData.ShelfCommFail = false;
-
- if (wMode == false)
- {
- short[] result_code = csSerialCommFunction.SerialRxProcess(ReadBuf, RequestRegAddr, rPosition, ref SystemData);
-
- OnUpdate?.Invoke(this, ref SystemData);
- }
- else
- {
- wMode = false;
- WriteRegAddr = 0;
- if (OnDataRecv != null)
- {
- byte[] adata = new byte[rPosition + 1];
- for (int j = 0; j < adata.Length; j++) { adata[j] = ReadBuf[j]; }
- OnDataRecv(adata);
- }
- }
- rFlag = false;
- Thread.Sleep(5);
- goto StartSend;
- case 2: // Fw Update Packet OK
- TimeOutCount = 0;
- rFlag = false;
- if (OnDataRecv != null)
- {
- byte[] adata = new byte[rPosition + 1];
- for (int j = 0; j < adata.Length; j++)
- {
- adata[j] = ReadBuf[j];
- }
- OnDataRecv(adata);
- }
- goto StartSend;
- case -1: // Packet error
- RecvPacketInit();
- Thread.Sleep(100);
- goto StartSend;
- default:
- break;
- }
+ BuffStart = true;
}
}
else
{
- Thread.Sleep(1);
- if (rTimeOut > 0)
+ ReadBuf[rPosition++] = cData;
+
+ int checkResult = csSerialCommFunction.ModbusPacketFromSlaveCheck(ReadBuf, rPosition);
+ if (checkResult == 0)
{
- rTimeOut--;
+ // Need more data
+ }
+ else if (checkResult == 1)
+ {
+ // Packet OK
+ TimeOutCount = 0;
+ SystemData.CommFail = false;
+ SystemData.ShelfCommFail = false;
+
+ byte[] rxPacket = new byte[rPosition];
+ Array.Copy(ReadBuf, rxPacket, rPosition);
+ OnPacketLog?.Invoke(DateTime.Now, false, rxPacket, GetRxDescription(rxPacket, currentTx));
+
+ if (currentTx.TxType == UartTxType.Polling)
+ {
+ csSerialCommFunction.SerialRxProcess(ReadBuf, currentTx.RegAddr, rPosition, ref SystemData);
+ OnUpdate?.Invoke(this, ref SystemData);
+ }
+ else
+ {
+ if (OnDataRecv != null)
+ {
+ byte[] adata = new byte[rPosition + 1];
+ for (int j = 0; j < adata.Length; j++) { adata[j] = ReadBuf[j]; }
+ OnDataRecv(adata);
+ }
+ }
+
+ packetHandled = true;
+ Thread.Sleep(5);
+ break;
+ }
+ else if (checkResult == 2)
+ {
+ // Fw Update Packet OK
+ TimeOutCount = 0;
+ byte[] rxPacket = new byte[rPosition];
+ Array.Copy(ReadBuf, rxPacket, rPosition);
+ OnPacketLog?.Invoke(DateTime.Now, false, rxPacket, "Fw Update Response OK");
+
+ if (OnDataRecv != null)
+ {
+ byte[] adata = new byte[rPosition + 1];
+ for (int j = 0; j < adata.Length; j++) { adata[j] = ReadBuf[j]; }
+ OnDataRecv(adata);
+ }
+
+ packetHandled = true;
+ Thread.Sleep(5);
+ break;
+ }
+ else if (checkResult == -1)
+ {
+ // Packet Error
+ byte[] rxPacket = new byte[rPosition];
+ Array.Copy(ReadBuf, rxPacket, rPosition);
+ OnPacketLog?.Invoke(DateTime.Now, false, rxPacket, "Packet CRC/Format Error");
+
+ RecvPacketInit();
+ Thread.Sleep(20);
+ packetHandled = true;
+ break;
}
}
}
-
- if (rPosition > 0)
- {
- Thread.Sleep(1);
- }
else
{
- WriteRegAddr = 0;
- TimeOutCount++;
- if (TimeOutCount >= 5)
+ Thread.Sleep(1);
+ rTimeOut--;
+ }
+ }
+
+ // 타임아웃 처리
+ if (!packetHandled)
+ {
+ TimeOutCount++;
+ if (TimeOutCount >= 5)
+ {
+ TimeOutCount = 5;
+ if (SystemData.ShelfCommFail == false)
{
- TimeOutCount = 5;
- //SystemData[0].CommFail = true;
- if (SystemData.ShelfCommFail == false)
- {
- SystemData.ShelfCommFail = true;
- DataInit();
- }
+ SystemData.ShelfCommFail = true;
+ DataInit();
}
- Thread.Sleep(100);
}
OnUpdate?.Invoke(this, ref SystemData);
- Thread.Sleep(1);
+ Thread.Sleep(50);
}
- else
- {
- Thread.Sleep(100);
- } /* if (rFlag == true) */
+
rPosition = 0;
}
else
{
- Thread.Sleep(100);
+ // No reply expected
+ Thread.Sleep(10);
}
}
}
@@ -850,5 +772,62 @@ namespace LFP_Manager.Threads
}
#endregion
+
+ #region PACKET LOG HELPERS
+
+ private string GetTxDescription(TUartTxItem item)
+ {
+ if (item == null) return "Unknown TX";
+ switch (item.TxType)
+ {
+ case UartTxType.Polling:
+ return string.Format("Polling (ID:{0}, Addr:0x{1:X4}, Len:{2})", item.SystemId, item.RegAddr, item.RegLen);
+ case UartTxType.WriteParam:
+ return string.Format("Write Param (ID:{0}, Addr:0x{1:X4})", item.SystemId, item.RegAddr);
+ case UartTxType.WriteCoil:
+ return string.Format("Write Coil (ID:{0}, Addr:0x{1:X4})", item.SystemId, item.RegAddr);
+ case UartTxType.WriteReg:
+ return string.Format("Write Reg (ID:{0}, Addr:0x{1:X4}, Len:{2})", item.SystemId, item.RegAddr, item.RegLen);
+ case UartTxType.ReadReg:
+ return string.Format("Read Reg (ID:{0}, Addr:0x{1:X4}, Len:{2})", item.SystemId, item.RegAddr, item.RegLen);
+ case UartTxType.FwUpdate:
+ return string.Format("FW Update (ID:{0}, Len:{1})", item.SystemId, item.Data != null ? item.Data.Length : 0);
+ default:
+ return string.Format("RAW TX (ID:{0}, Len:{1})", item.SystemId, item.Data != null ? item.Data.Length : 0);
+ }
+ }
+
+ private string GetRxDescription(byte[] rxPacket, TUartTxItem item)
+ {
+ if (rxPacket == null || rxPacket.Length < 3) return "Unknown RX";
+ byte devId = rxPacket[0];
+ byte funcCode = rxPacket[1];
+
+ if (funcCode == 0x03)
+ {
+ byte byteCount = rxPacket[2];
+ if (item != null && item.TxType == UartTxType.Polling)
+ {
+ return string.Format("Polling Response (ID:{0}, Bytes:{1})", devId, byteCount);
+ }
+ return string.Format("Read Holding Reg Response (ID:{0}, Bytes:{1})", devId, byteCount);
+ }
+ else if (funcCode == 0x05)
+ {
+ return string.Format("Write Coil Response (ID:{0})", devId);
+ }
+ else if (funcCode == 0x06 || funcCode == 0x10)
+ {
+ return string.Format("Write Reg Response (ID:{0})", devId);
+ }
+ else if (funcCode > 0x80)
+ {
+ byte errCode = rxPacket.Length > 2 ? rxPacket[2] : (byte)0;
+ return string.Format("Modbus Error Response (ID:{0}, Func:0x{1:X2}, ErrCode:0x{2:X2})", devId, funcCode, errCode);
+ }
+ return string.Format("RX Data (ID:{0}, Func:0x{1:X2}, Len:{2})", devId, funcCode, rxPacket.Length);
+ }
+
+ #endregion
}
}
diff --git a/LFP_Manager/Utils/csLog.cs b/LFP_Manager/Utils/csLog.cs
index 0792e66..576fc52 100644
--- a/LFP_Manager/Utils/csLog.cs
+++ b/LFP_Manager/Utils/csLog.cs
@@ -294,8 +294,9 @@ namespace LFP_Manager.Utils
private static string GetStatusString(short aStatus, short aProtection = 0)
{
string result = "";
+ ushort uStatus = (ushort)(aStatus & 0x7FFF);
- switch ((ushort)aStatus)
+ switch (uStatus)
{
case 0x0000:
result = "STANDBY";
@@ -321,23 +322,8 @@ namespace LFP_Manager.Utils
case 0x0032:
result = "POWER-ON";
break;
- case 0x8000:
- result = "STANDBY-HEAT";
- break;
- case 0x8001:
- result = "CHARGING-HEAT";
- break;
- case 0x8002:
- result = "DISCHARGING-HEAT";
- break;
- case 0x8004:
- result = "TRIP-HEAT";
- break;
- case 0x8008:
- result = "CHG-LIMIT-HEAT";
- break;
default:
- result = string.Format("UNKNOWN(0x{0:X4})", (ushort)aStatus);
+ result = string.Format("UNKNOWN(0x{0:X4})", uStatus);
break;
}
return result;