diff --git a/INT_PT002/Controls/System/ControlMenuSystemInformation.cs b/INT_PT002/Controls/System/ControlMenuSystemInformation.cs index 456962f..2487e37 100644 --- a/INT_PT002/Controls/System/ControlMenuSystemInformation.cs +++ b/INT_PT002/Controls/System/ControlMenuSystemInformation.cs @@ -200,6 +200,7 @@ namespace INT_PT002.Controls private void MainboardProgramUpdateCheck(DialogResult result) { Define.E_UpdateCheck check = Define.E_UpdateCheck.Fail; + this.UpdateFileMainboardPath = this.USBPath + "UpdateFilesMain\\"; if (result == DialogResult.Yes) { diff --git a/INT_PT002/DialogForms/DialogFormProgressBar.Designer.cs b/INT_PT002/DialogForms/DialogFormProgressBar.Designer.cs index 6aaf662..b8799fa 100644 --- a/INT_PT002/DialogForms/DialogFormProgressBar.Designer.cs +++ b/INT_PT002/DialogForms/DialogFormProgressBar.Designer.cs @@ -39,6 +39,7 @@ this.smartSerialPort2 = new SmartX.SmartSerialPort(this.components); this.timerForMainBoard = new SmartX.SmartTimer(); this.smartTimerReboot = new SmartX.SmartTimer(); + this.smartFileCommunicationLog = new SmartX.SmartFile(); this.smartGroupBox1.SuspendLayout(); this.SuspendLayout(); // @@ -78,7 +79,7 @@ this.buttonOK.ImageDisable = null; this.buttonOK.ImageDown = null; this.buttonOK.ImageUp = null; - this.buttonOK.Location = new System.Drawing.Point(179, 153); + this.buttonOK.Location = new System.Drawing.Point(179, 158); this.buttonOK.Mode = SmartX.SmartButton.BUTTONMODE.NORMAL; this.buttonOK.Name = "buttonOK"; this.buttonOK.NestedClickEventPrevent = false; @@ -106,9 +107,9 @@ this.labelMessage2.BackGroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); this.labelMessage2.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(27)))), ((int)(((byte)(42)))), ((int)(((byte)(82))))); this.labelMessage2.BorderStyle = SmartX.SmartLabel.BorderStyles.None; - this.labelMessage2.Font = new System.Drawing.Font("New Gulim", 10F, System.Drawing.FontStyle.Regular); + this.labelMessage2.Font = new System.Drawing.Font("새굴림", 10F, System.Drawing.FontStyle.Regular); this.labelMessage2.LineSpacing = 0F; - this.labelMessage2.Location = new System.Drawing.Point(43, 84); + this.labelMessage2.Location = new System.Drawing.Point(43, 90); this.labelMessage2.Name = "labelMessage2"; this.labelMessage2.OverlapOptimize = true; this.labelMessage2.PasswordChar = '\0'; @@ -135,7 +136,7 @@ this.progressBarUpdate.BarStyle = SmartX.SmartProgressBar.BARTYPE.Normal; this.progressBarUpdate.Direction = SmartX.SmartProgressBar.DIR.Horizontal; this.progressBarUpdate.FormatString = ""; - this.progressBarUpdate.Location = new System.Drawing.Point(25, 117); + this.progressBarUpdate.Location = new System.Drawing.Point(25, 123); this.progressBarUpdate.Maximum = new decimal(new int[] { 100, 0, @@ -170,9 +171,9 @@ this.labelMessage1.BackGroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); this.labelMessage1.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(27)))), ((int)(((byte)(42)))), ((int)(((byte)(82))))); this.labelMessage1.BorderStyle = SmartX.SmartLabel.BorderStyles.None; - this.labelMessage1.Font = new System.Drawing.Font("New Gulim", 10F, System.Drawing.FontStyle.Regular); + this.labelMessage1.Font = new System.Drawing.Font("새굴림", 10F, System.Drawing.FontStyle.Regular); this.labelMessage1.LineSpacing = 0F; - this.labelMessage1.Location = new System.Drawing.Point(43, 62); + this.labelMessage1.Location = new System.Drawing.Point(43, 68); this.labelMessage1.Name = "labelMessage1"; this.labelMessage1.OverlapOptimize = true; this.labelMessage1.PasswordChar = '\0'; @@ -213,7 +214,7 @@ this.smartSerialPort2.ErrorCode_Location = SmartX.SmartSerialPort.ERRORCODELOCATION.HEADER; this.smartSerialPort2.ETXCode = ((byte)(3)); this.smartSerialPort2.ETXCodes = null; - this.smartSerialPort2.FrameBufferSize = ((uint)(2048u)); + this.smartSerialPort2.FrameBufferSize = ((uint)(1024u)); this.smartSerialPort2.FrameSeparationType = SmartX.SmartSerialPort.FRAMESEPARATIONTYPES.STXANDETX; this.smartSerialPort2.HeadErrorCodeOffset = 0; this.smartSerialPort2.PortNo = SmartX.SmartSerialPort.COMPORTNO.COM2; @@ -244,6 +245,10 @@ this.smartTimerReboot.TimeFormStringSeparator = ":"; this.smartTimerReboot.Tick += new System.EventHandler(this.smartTimerReboot_Tick); // + // smartFileCommunicationLog + // + this.smartFileCommunicationLog.FilePathName = ""; + // // DialogFormProgressBar // this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); @@ -273,5 +278,6 @@ private SmartX.SmartButton buttonOK; private SmartX.SmartTimer timerForMainBoard; private SmartX.SmartTimer smartTimerReboot; + private SmartX.SmartFile smartFileCommunicationLog; } } \ No newline at end of file diff --git a/INT_PT002/DialogForms/DialogFormProgressBar.cs b/INT_PT002/DialogForms/DialogFormProgressBar.cs index 3e7cb68..1c4a4b2 100644 --- a/INT_PT002/DialogForms/DialogFormProgressBar.cs +++ b/INT_PT002/DialogForms/DialogFormProgressBar.cs @@ -182,7 +182,7 @@ namespace INT_PT002.DialogForms this.USBPath = "하드 디스크\\"; this.UpdateFileDisplayPath = this.USBPath + "UpdateFiles\\"; - this.UpdateFileMainboardPath = this.USBPath + "UpdateFilesMain\\"; + this.UpdateFileMainboardPath = this.USBPath + "UpdateFilesMain\\ibd902m.bin"; //this.OldFilePath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) + "\\"; this.OldFilePath = "SD Card\\Run\\"; this.RemoveFolderPath = "SD Card\\RemoveFile\\"; @@ -242,118 +242,12 @@ namespace INT_PT002.DialogForms { } - #region Test 용 통신 로그 - //fullPath = this.PathDataBackupFolder + "UpdateMainboard.txt"; - //this.smartFileCommunicationLog.FilePathName = fullPath; - //this.smartFileCommunicationLog.Open(); - //this.IsCommunicationLogOpen = true; - #endregion } public void CloseSerialPort2() { this.smartSerialPort2.Close(); } - - private void smartSerialPort2_OnReadQueueEvent() - { - int ret = 0, index = 0; - byte[] beforeData; - string ack = "", data = ""; - string cmd = "", address = "", lane = "", receiveData = ""; - string strTemp = ""; - byte[] readByte; - Define.E_ResponseData response = Define.E_ResponseData.NAK; - - SmartSerialPort.FRAMEDATAREADSTATUS receiveDataState = SmartSerialPort.FRAMEDATAREADSTATUS.EMPTY; - - try - { - receiveDataState = this.smartSerialPort2.ReadQueue(out readByte); - strTemp = Encoding.Default.GetString(readByte, 0, readByte.Length); - } - catch - { - return; - } - - if ((receiveDataState == SmartSerialPort.FRAMEDATAREADSTATUS.EMPTY) || (receiveDataState == SmartSerialPort.FRAMEDATAREADSTATUS.FAILDATA)) - { - return; - } - - cmd = strTemp.Substring(0, 3); - lane = strTemp.Substring(5, 1); - address = strTemp.Substring(10, 4); - receiveData = strTemp.Substring(14, strTemp.Length - 16); - - try - { - switch (address) - { - case "1651": - #region 업데이트 - #region Value Assign - try - { - index = int.Parse(receiveData.Substring(0, 4)); - } - catch - { - index = 0; - } - ack = receiveData.Substring(4, 4); - #endregion - - if (ack == "0001") - response = Define.E_ResponseData.ACK; - else - response = Define.E_ResponseData.NAK; - - if (this.UpdateForMain.Index == index) - { - this.smartTimerUpdate.Stop(); - if (response == Define.E_ResponseData.ACK) - { - beforeData = new byte[this.UpdateForMain.ByteData.Length]; - for (int i = 0; i < this.UpdateForMain.ByteData.Length; i++) - beforeData[i] = this.UpdateForMain.ByteData[i]; - - if (this.UpdateForMain.IsLastData == false) - { - this.UpdateForMain.ByteData = new byte[beforeData.Length - 128]; - for (int i = 0; i < beforeData.Length - 128; i++) - this.UpdateForMain.ByteData[i] = beforeData[128 + i]; - this.UpdateForMain.Index++; - - this.SendUpdateForMain(this.UpdateForMain.ByteData); - } - else - { - this.progressBarUpdate.Value += 5; - } - } - else - { - this.RetryUpdateForMain(this.UpdateForMain); - } - } - else - { - this.smartTimerUpdate.Stop(); - this.UpdateMainBoardFail(this.Language); - } - #endregion - break; - default: - break; - } - } - catch - { - ret = -1; - } - } - + private string Checksumcalculator(string strTemp) { string chkSum = ""; @@ -565,8 +459,6 @@ namespace INT_PT002.DialogForms count = byteCount / 128; this.UpdateForMain.SendDataCount = count; - this.UpdateLabelStatus(this.Language); - this.timerForMainBoard.Start(); } @@ -591,7 +483,7 @@ namespace INT_PT002.DialogForms } #endregion - private void UpdateLabelStatus(Define.E_LanguageID language) + private void UpdateMainBoardFinish(Define.E_LanguageID language) { switch (language) { @@ -625,6 +517,127 @@ namespace INT_PT002.DialogForms #endregion #region Event Handler + private void smartSerialPort2_OnReadQueueEvent() + { + int ret = 0, index = 0; + byte[] beforeData; + string ack = "", data = ""; + string cmd = "", address = "", lane = "", receiveData = ""; + string strTemp = ""; + byte[] readByte; + Define.E_ResponseData response = Define.E_ResponseData.NAK; + + SmartSerialPort.FRAMEDATAREADSTATUS receiveDataState = SmartSerialPort.FRAMEDATAREADSTATUS.EMPTY; + + try + { + receiveDataState = this.smartSerialPort2.ReadQueue(out readByte); + strTemp = Encoding.Default.GetString(readByte, 0, readByte.Length); + } + catch + { + return; + } + + if ((receiveDataState == SmartSerialPort.FRAMEDATAREADSTATUS.EMPTY) || (receiveDataState == SmartSerialPort.FRAMEDATAREADSTATUS.FAILDATA)) + { + return; + } + + cmd = strTemp.Substring(0, 3); + lane = strTemp.Substring(5, 1); + address = strTemp.Substring(10, 4); + receiveData = strTemp.Substring(14, strTemp.Length - 16); + + try + { + switch (strTemp[0]) + { + case 'C': + switch (cmd) + { + case "CBU": + this.UpdateMainBoardFinish(Language); + break; + default: + break; + } + break; + case 'P': + switch (address) + { + case "1651": + #region 업데이트 + #region Value Assign + try + { + index = int.Parse(receiveData.Substring(0, 4)); + } + catch + { + index = 0; + } + ack = receiveData.Substring(4, 4); + #endregion + + if (ack == "0001") + response = Define.E_ResponseData.ACK; + else + response = Define.E_ResponseData.NAK; + + if (this.UpdateForMain.Index == index) + { + this.smartTimerUpdate.Stop(); + if (response == Define.E_ResponseData.ACK) + { + beforeData = new byte[this.UpdateForMain.ByteData.Length]; + for (int i = 0; i < this.UpdateForMain.ByteData.Length; i++) + beforeData[i] = this.UpdateForMain.ByteData[i]; + + if (this.UpdateForMain.IsLastData == false) + { + this.UpdateForMain.ByteData = new byte[beforeData.Length - 128]; + for (int i = 0; i < beforeData.Length - 128; i++) + this.UpdateForMain.ByteData[i] = beforeData[128 + i]; + this.UpdateForMain.Index++; + + this.SendUpdateForMain(this.UpdateForMain.ByteData); + } + else + { + this.progressBarUpdate.Value += 5; + } + } + else + { + this.RetryUpdateForMain(this.UpdateForMain); + } + } + else + { + this.smartTimerUpdate.Stop(); + this.UpdateMainBoardFail(this.Language); + } + #endregion + break; + default: + break; + } + break; + case 'S': + break; + default: + break; + } + + + } + catch + { + ret = -1; + } + } + private void timerUpdate_Tick(object sender, EventArgs e) { this.Check += 1; @@ -657,10 +670,7 @@ namespace INT_PT002.DialogForms } if (this.progressBarUpdate.Value == 100) - { - this.UpdateLabelStatus(Language); this.timerUpdate.Stop(); - } } private void timerForMainBoard_Tick(object sender, EventArgs e) { diff --git a/INT_PT002/DialogForms/DialogFormProgressBar.resx b/INT_PT002/DialogForms/DialogFormProgressBar.resx index 2664d70..ba23a37 100644 --- a/INT_PT002/DialogForms/DialogFormProgressBar.resx +++ b/INT_PT002/DialogForms/DialogFormProgressBar.resx @@ -132,6 +132,9 @@ 595, 17 + + 750, 17 + WEBPAD diff --git a/INT_PT002/DialogForms/DialogFormYesNo.Designer.cs b/INT_PT002/DialogForms/DialogFormYesNo.Designer.cs index 67be943..40b9975 100644 --- a/INT_PT002/DialogForms/DialogFormYesNo.Designer.cs +++ b/INT_PT002/DialogForms/DialogFormYesNo.Designer.cs @@ -32,12 +32,12 @@ this.buttonYes = new SmartX.SmartButton(); this.buttonNo = new SmartX.SmartButton(); this.smartGroupBox1 = new SmartX.SmartGroupBox(); - this.labelMessage1 = new SmartX.SmartLabel(); - this.labelMessage2 = new SmartX.SmartLabel(); this.pictureBoxExclamation = new System.Windows.Forms.PictureBox(); this.pictureBoxHand = new System.Windows.Forms.PictureBox(); this.pictureBoxAsterisk = new System.Windows.Forms.PictureBox(); this.pictureBoxQuestion = new System.Windows.Forms.PictureBox(); + this.labelMessage1 = new SmartX.SmartLabel(); + this.labelMessage2 = new SmartX.SmartLabel(); this.smartGroupBox1.SuspendLayout(); this.SuspendLayout(); // @@ -55,7 +55,7 @@ this.buttonYes.ImageDisable = null; this.buttonYes.ImageDown = null; this.buttonYes.ImageUp = null; - this.buttonYes.Location = new System.Drawing.Point(249, 126); + this.buttonYes.Location = new System.Drawing.Point(249, 122); this.buttonYes.Mode = SmartX.SmartButton.BUTTONMODE.NORMAL; this.buttonYes.Name = "buttonYes"; this.buttonYes.NestedClickEventPrevent = false; @@ -90,7 +90,7 @@ this.buttonNo.ImageDisable = null; this.buttonNo.ImageDown = null; this.buttonNo.ImageUp = null; - this.buttonNo.Location = new System.Drawing.Point(345, 126); + this.buttonNo.Location = new System.Drawing.Point(345, 122); this.buttonNo.Mode = SmartX.SmartButton.BUTTONMODE.NORMAL; this.buttonNo.Name = "buttonNo"; this.buttonNo.NestedClickEventPrevent = false; @@ -116,14 +116,14 @@ this.smartGroupBox1.BackGround = null; this.smartGroupBox1.BackGroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); this.smartGroupBox1.BackImage = null; + this.smartGroupBox1.Controls.Add(this.buttonYes); + this.smartGroupBox1.Controls.Add(this.buttonNo); this.smartGroupBox1.Controls.Add(this.pictureBoxExclamation); this.smartGroupBox1.Controls.Add(this.pictureBoxHand); this.smartGroupBox1.Controls.Add(this.pictureBoxAsterisk); this.smartGroupBox1.Controls.Add(this.pictureBoxQuestion); this.smartGroupBox1.Controls.Add(this.labelMessage1); this.smartGroupBox1.Controls.Add(this.labelMessage2); - this.smartGroupBox1.Controls.Add(this.buttonNo); - this.smartGroupBox1.Controls.Add(this.buttonYes); this.smartGroupBox1.FrameLineColor1 = System.Drawing.Color.FromArgb(((int)(((byte)(58)))), ((int)(((byte)(110)))), ((int)(((byte)(165))))); this.smartGroupBox1.FrameLineColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(58)))), ((int)(((byte)(110)))), ((int)(((byte)(165))))); this.smartGroupBox1.FrameLineThickness = 2; @@ -132,11 +132,39 @@ this.smartGroupBox1.Location = new System.Drawing.Point(0, 0); this.smartGroupBox1.Name = "smartGroupBox1"; this.smartGroupBox1.RoundRadius = 5; - this.smartGroupBox1.Size = new System.Drawing.Size(450, 155); + this.smartGroupBox1.Size = new System.Drawing.Size(450, 160); this.smartGroupBox1.TabIndex = 7; this.smartGroupBox1.Text = "ErrorCode"; this.smartGroupBox1.TextColor = System.Drawing.Color.White; // + // pictureBoxExclamation + // + this.pictureBoxExclamation.Image = ((System.Drawing.Image)(resources.GetObject("pictureBoxExclamation.Image"))); + this.pictureBoxExclamation.Location = new System.Drawing.Point(20, 55); + this.pictureBoxExclamation.Name = "pictureBoxExclamation"; + this.pictureBoxExclamation.Size = new System.Drawing.Size(50, 50); + // + // pictureBoxHand + // + this.pictureBoxHand.Image = ((System.Drawing.Image)(resources.GetObject("pictureBoxHand.Image"))); + this.pictureBoxHand.Location = new System.Drawing.Point(20, 55); + this.pictureBoxHand.Name = "pictureBoxHand"; + this.pictureBoxHand.Size = new System.Drawing.Size(50, 50); + // + // pictureBoxAsterisk + // + this.pictureBoxAsterisk.Image = ((System.Drawing.Image)(resources.GetObject("pictureBoxAsterisk.Image"))); + this.pictureBoxAsterisk.Location = new System.Drawing.Point(20, 55); + this.pictureBoxAsterisk.Name = "pictureBoxAsterisk"; + this.pictureBoxAsterisk.Size = new System.Drawing.Size(50, 50); + // + // pictureBoxQuestion + // + this.pictureBoxQuestion.Image = ((System.Drawing.Image)(resources.GetObject("pictureBoxQuestion.Image"))); + this.pictureBoxQuestion.Location = new System.Drawing.Point(20, 55); + this.pictureBoxQuestion.Name = "pictureBoxQuestion"; + this.pictureBoxQuestion.Size = new System.Drawing.Size(50, 50); + // // labelMessage1 // this.labelMessage1.BackGround = null; @@ -183,41 +211,13 @@ this.labelMessage2.TextVAlign = SmartX.SmartLabel.TextVerAlign.Top; this.labelMessage2.Wordwrap = false; // - // pictureBoxExclamation - // - this.pictureBoxExclamation.Image = ((System.Drawing.Image)(resources.GetObject("pictureBoxExclamation.Image"))); - this.pictureBoxExclamation.Location = new System.Drawing.Point(20, 55); - this.pictureBoxExclamation.Name = "pictureBoxExclamation"; - this.pictureBoxExclamation.Size = new System.Drawing.Size(50, 50); - // - // pictureBoxHand - // - this.pictureBoxHand.Image = ((System.Drawing.Image)(resources.GetObject("pictureBoxHand.Image"))); - this.pictureBoxHand.Location = new System.Drawing.Point(20, 55); - this.pictureBoxHand.Name = "pictureBoxHand"; - this.pictureBoxHand.Size = new System.Drawing.Size(50, 50); - // - // pictureBoxAsterisk - // - this.pictureBoxAsterisk.Image = ((System.Drawing.Image)(resources.GetObject("pictureBoxAsterisk.Image"))); - this.pictureBoxAsterisk.Location = new System.Drawing.Point(20, 55); - this.pictureBoxAsterisk.Name = "pictureBoxAsterisk"; - this.pictureBoxAsterisk.Size = new System.Drawing.Size(50, 50); - // - // pictureBoxQuestion - // - this.pictureBoxQuestion.Image = ((System.Drawing.Image)(resources.GetObject("pictureBoxQuestion.Image"))); - this.pictureBoxQuestion.Location = new System.Drawing.Point(20, 55); - this.pictureBoxQuestion.Name = "pictureBoxQuestion"; - this.pictureBoxQuestion.Size = new System.Drawing.Size(50, 50); - // // DialogFormYesNo // this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; this.AutoScroll = true; this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(58)))), ((int)(((byte)(110)))), ((int)(((byte)(165))))); - this.ClientSize = new System.Drawing.Size(450, 155); + this.ClientSize = new System.Drawing.Size(450, 160); this.ControlBox = false; this.Controls.Add(this.smartGroupBox1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; diff --git a/INT_PT002/DialogForms/DialogFormYesNo.cs b/INT_PT002/DialogForms/DialogFormYesNo.cs index c84abfc..c057eb5 100644 --- a/INT_PT002/DialogForms/DialogFormYesNo.cs +++ b/INT_PT002/DialogForms/DialogFormYesNo.cs @@ -330,6 +330,7 @@ namespace INT_PT002.DialogForms y = Screen.PrimaryScreen.Bounds.Height / 2 - this.Size.Height / 2; this.Location = new Point(x, y); + this.Size = new Size(452, 162); } #endregion @@ -339,7 +340,6 @@ namespace INT_PT002.DialogForms base.OnLoad(e); this.InitializeControl(); - this.Size = new Size(450, 155); } #endregion