Ver código fonte

File Download Class Get 메서드추가

YJ 6 anos atrás
pai
commit
9db1b09b71

+ 5 - 3
Basic_Terminal/Func/Data_Handler.cs

@@ -8,9 +8,11 @@ namespace Basic_Terminal
8 8
 {
9 9
     class Data_Handler
10 10
     {
11
-        public void Recv_dataCheck(byte[] data)
11
+        FileDownload fileDownload;
12
+        public void Recv_dataCheck(object fileDownload, byte[] data)
12 13
         {
13
-            Boolean HeaderCheck = Serial_HeaderCheck(data);
14
+            this.fileDownload = (FileDownload)fileDownload;
15
+            Boolean HeaderCheck = this.fileDownload.Serial_HeaderCheck(data);
14 16
             int DataAckcnt = data[(int)Bluepro_t.bluecell_type + 1];
15 17
             if (HeaderCheck == false)
16 18
             {
@@ -22,7 +24,7 @@ namespace Basic_Terminal
22 24
                 switch (seq)
23 25
                 {
24 26
                     case DataSeq.UpdateSendingOK:
25
-                        UpdateFileSend(data, DataAckcnt);
27
+                        this.fileDownload.UpdateFileSend(data, DataAckcnt);
26 28
                         break;
27 29
                     case DataSeq.UpdateEndOK:
28 30
                         break;

+ 2 - 1
Basic_Terminal/Func/FileDownload.cs

@@ -41,6 +41,7 @@ namespace Basic_Terminal
41 41
                 string fileFullName = this.ofd.FileName;//File경로와 File명을 모두 가지고 온다.
42 42
                 string filePath = fileFullName.Replace(fileName, "");//File경로만 가지고 온다.
43 43
                 Bluecell_BootProtocol.Boot_Reset(serial);
44
+                this.serial.FileDownloadClass_Get(this);
44 45
                 //UpdateFileSend(File.ReadAllBytes(this.ofd.FileName));
45 46
                 return fileFullName;
46 47
             }
@@ -75,7 +76,7 @@ namespace Basic_Terminal
75 76
             }
76 77
         }
77 78
 #endif
78
-        private void UpdateFileSend(byte[] data,int cnt)
79
+        public void UpdateFileSend(byte[] data,int cnt)
79 80
         {
80 81
             /*Define*/
81 82
             int Quotient = 0,remainder = 0;

+ 6 - 1
Basic_Terminal/Func/Serial.cs

@@ -16,6 +16,7 @@ namespace Basic_Terminal
16 16
         private Debug Debug = new Debug();    // Teminal Text Wnd Open
17 17
         public string Serial_Name { get => serialPort.PortName;  set => serialPort.PortName = value;}
18 18
         Data_Handler data_Handler = new Data_Handler();
19
+        FileDownload fileDownload;
19 20
         public void Serial_Initialize(ref ComboBox cb_port)
20 21
         {
21 22
             
@@ -71,7 +72,7 @@ namespace Basic_Terminal
71 72
             else
72 73
                 Debug.Invoke(new StringSend(Debug.Data_Recv_Str), str2hex(data,true));
73 74
 
74
-            data_Handler.Recv_dataCheck(str2bytes(str2hex(data,false)));
75
+            data_Handler.Recv_dataCheck(this.fileDownload, str2bytes(str2hex(data,false)));
75 76
         }
76 77
         public Boolean Serial_PortOpen(ref Button Btn_Portonoff)
77 78
         {
@@ -125,5 +126,9 @@ namespace Basic_Terminal
125 126
             try { serialPort.Write(buffer, 0, count); }
126 127
             catch { MessageBox.Show("Port Open Failed!!!"); }
127 128
         }
129
+        public void FileDownloadClass_Get(object filedownload)
130
+        {
131
+            this.fileDownload = (FileDownload)filedownload;
132
+        }
128 133
     }
129 134
 }