Ver código fonte

Serial Tx Rx UI 표시 Form Get 함수 추가 /Serail Tx Rx UI Function 추가 /

YJ 6 anos atrás
pai
commit
fa235704d3

+ 14 - 1
Basic_Terminal/Func/Serial.cs

@@ -12,6 +12,7 @@ namespace RF_TRIO_PLL_ZIG
12 12
 {
13 13
     class Serial
14 14
     {
15
+        Main_Form main_form;
15 16
         private System.IO.Ports.SerialPort serialPort;
16 17
         private Debug Debug = new Debug();    // Teminal Text Wnd Open
17 18
         public string Serial_Name { get => serialPort.PortName;  set => serialPort.PortName = value;}
@@ -74,9 +75,11 @@ namespace RF_TRIO_PLL_ZIG
74 75
             return arr_byteStr;
75 76
 #endif
76 77
         }
77
-       
78
+        private delegate void BoolSet();
78 79
         public void Serial_DataRecvFunction(object sender, SerialDataReceivedEventArgs e)
79 80
         {
81
+            //this.main_form.RX_Light_ON();
82
+            main_form.Invoke(new BoolSet(main_form.RX_Light_ON));
80 83
             if (this.Debug.Created && Debug.RadioButton_ascii.Checked == true)
81 84
             {
82 85
                 string data = serialPort.ReadExisting();
@@ -129,6 +132,7 @@ namespace RF_TRIO_PLL_ZIG
129 132
                     {
130 133
                         serialPort.Open();
131 134
                         Btn_Portonoff.Text = "Port Close";
135
+                        Debug.Debug_Main_Form_Get(this.main_form);
132 136
                     }
133 137
                     else
134 138
                     {
@@ -162,6 +166,8 @@ namespace RF_TRIO_PLL_ZIG
162 166
             try
163 167
             {
164 168
                 serialPort.Write(data,0,data.Length);
169
+                main_form.pictureBox_R_TX.Visible = false;
170
+                main_form.pictureBox_G_TX.Visible = true;
165 171
             }
166 172
             catch (System.Exception ex)
167 173
             {
@@ -172,6 +178,8 @@ namespace RF_TRIO_PLL_ZIG
172 178
         {
173 179
             try { serialPort.Write(buffer, 0, count); }
174 180
             catch { MessageBox.Show("Port Open Failed!!!"); }
181
+            main_form.Invoke(new BoolSet(main_form.TX_Light_ON));
182
+            
175 183
         }
176 184
         public void FileDownloadClass_Get(object filedownload)
177 185
         {
@@ -202,5 +210,10 @@ namespace RF_TRIO_PLL_ZIG
202 210
             if (this.Debug.Created)
203 211
                 this.Debug.ascii_to_hex_radiobuttonConvert();
204 212
         }
213
+        
214
+        public void Serial_Main_Form_Get(object frm)
215
+        {
216
+            this.main_form = (Main_Form)frm;
217
+        }
205 218
     }
206 219
 }

+ 6 - 0
Basic_Terminal/Wnd/Debug.cs

@@ -13,6 +13,7 @@ namespace RF_TRIO_PLL_ZIG
13 13
 {
14 14
     public partial class Debug : Form
15 15
     {
16
+        Main_Form main_form;
16 17
         int LineLimit = 500;
17 18
         [DllImport("user32.dll")]
18 19
         public static extern int SendMessage(IntPtr hWnd, Int32 wMsg, bool wParam, Int32 lParam);
@@ -30,6 +31,7 @@ namespace RF_TRIO_PLL_ZIG
30 31
 #if true
31 32
         public void Data_Recv_Str(string text)
32 33
         {
34
+           
33 35
             int nLimitLines = Convert.ToInt32(LineLimit); //제한 라인 수
34 36
             try
35 37
             {
@@ -170,5 +172,9 @@ namespace RF_TRIO_PLL_ZIG
170 172
             radioButton_ascii.Checked = true;
171 173
             radioButton_hex.Checked = false;
172 174
         }
175
+        public void Debug_Main_Form_Get(object frm)
176
+        {
177
+            this.main_form = (Main_Form)frm;
178
+        }
173 179
     }
174 180
 }

+ 24 - 4
Basic_Terminal/Wnd/Main_Form.Designer.cs

@@ -1322,6 +1322,7 @@
1322 1322
             this.pictureBox_PATH_3_5G_L_ON.Size = new System.Drawing.Size(38, 36);
1323 1323
             this.pictureBox_PATH_3_5G_L_ON.TabIndex = 96;
1324 1324
             this.pictureBox_PATH_3_5G_L_ON.TabStop = false;
1325
+            this.pictureBox_PATH_3_5G_L_ON.Click += new System.EventHandler(this.Power_OnOff_Set);
1325 1326
             // 
1326 1327
             // pictureBox_PATH_3_5G_L_OFF
1327 1328
             // 
@@ -1331,6 +1332,7 @@
1331 1332
             this.pictureBox_PATH_3_5G_L_OFF.Size = new System.Drawing.Size(38, 36);
1332 1333
             this.pictureBox_PATH_3_5G_L_OFF.TabIndex = 96;
1333 1334
             this.pictureBox_PATH_3_5G_L_OFF.TabStop = false;
1335
+            this.pictureBox_PATH_3_5G_L_OFF.Click += new System.EventHandler(this.Power_OnOff_Set);
1334 1336
             // 
1335 1337
             // pictureBox_PATH_3_5G_H_ON
1336 1338
             // 
@@ -1340,6 +1342,7 @@
1340 1342
             this.pictureBox_PATH_3_5G_H_ON.Size = new System.Drawing.Size(38, 36);
1341 1343
             this.pictureBox_PATH_3_5G_H_ON.TabIndex = 96;
1342 1344
             this.pictureBox_PATH_3_5G_H_ON.TabStop = false;
1345
+            this.pictureBox_PATH_3_5G_H_ON.Click += new System.EventHandler(this.Power_OnOff_Set);
1343 1346
             // 
1344 1347
             // pictureBox_PATH_3_5G_H_OFF
1345 1348
             // 
@@ -1349,6 +1352,7 @@
1349 1352
             this.pictureBox_PATH_3_5G_H_OFF.Size = new System.Drawing.Size(38, 36);
1350 1353
             this.pictureBox_PATH_3_5G_H_OFF.TabIndex = 96;
1351 1354
             this.pictureBox_PATH_3_5G_H_OFF.TabStop = false;
1355
+            this.pictureBox_PATH_3_5G_H_OFF.Click += new System.EventHandler(this.Power_OnOff_Set);
1352 1356
             // 
1353 1357
             // pictureBox_PLL_ON_OFF_3_5G_L_ON
1354 1358
             // 
@@ -1358,6 +1362,7 @@
1358 1362
             this.pictureBox_PLL_ON_OFF_3_5G_L_ON.Size = new System.Drawing.Size(38, 36);
1359 1363
             this.pictureBox_PLL_ON_OFF_3_5G_L_ON.TabIndex = 96;
1360 1364
             this.pictureBox_PLL_ON_OFF_3_5G_L_ON.TabStop = false;
1365
+            this.pictureBox_PLL_ON_OFF_3_5G_L_ON.Click += new System.EventHandler(this.Power_OnOff_Set);
1361 1366
             // 
1362 1367
             // pictureBox_PLL_ON_OFF_3_5G_L_OFF
1363 1368
             // 
@@ -1367,6 +1372,7 @@
1367 1372
             this.pictureBox_PLL_ON_OFF_3_5G_L_OFF.Size = new System.Drawing.Size(38, 36);
1368 1373
             this.pictureBox_PLL_ON_OFF_3_5G_L_OFF.TabIndex = 96;
1369 1374
             this.pictureBox_PLL_ON_OFF_3_5G_L_OFF.TabStop = false;
1375
+            this.pictureBox_PLL_ON_OFF_3_5G_L_OFF.Click += new System.EventHandler(this.Power_OnOff_Set);
1370 1376
             // 
1371 1377
             // pictureBox_PLL_ON_OFF_3_5G_H_ON
1372 1378
             // 
@@ -1376,6 +1382,7 @@
1376 1382
             this.pictureBox_PLL_ON_OFF_3_5G_H_ON.Size = new System.Drawing.Size(38, 36);
1377 1383
             this.pictureBox_PLL_ON_OFF_3_5G_H_ON.TabIndex = 96;
1378 1384
             this.pictureBox_PLL_ON_OFF_3_5G_H_ON.TabStop = false;
1385
+            this.pictureBox_PLL_ON_OFF_3_5G_H_ON.Click += new System.EventHandler(this.Power_OnOff_Set);
1379 1386
             // 
1380 1387
             // pictureBox_PLL_ON_OFF_3_5G_H_OFF
1381 1388
             // 
@@ -1385,6 +1392,7 @@
1385 1392
             this.pictureBox_PLL_ON_OFF_3_5G_H_OFF.Size = new System.Drawing.Size(38, 36);
1386 1393
             this.pictureBox_PLL_ON_OFF_3_5G_H_OFF.TabIndex = 96;
1387 1394
             this.pictureBox_PLL_ON_OFF_3_5G_H_OFF.TabStop = false;
1395
+            this.pictureBox_PLL_ON_OFF_3_5G_H_OFF.Click += new System.EventHandler(this.Power_OnOff_Set);
1388 1396
             // 
1389 1397
             // pictureBox_PATH_3_5G_UL_ON
1390 1398
             // 
@@ -1394,6 +1402,7 @@
1394 1402
             this.pictureBox_PATH_3_5G_UL_ON.Size = new System.Drawing.Size(38, 36);
1395 1403
             this.pictureBox_PATH_3_5G_UL_ON.TabIndex = 96;
1396 1404
             this.pictureBox_PATH_3_5G_UL_ON.TabStop = false;
1405
+            this.pictureBox_PATH_3_5G_UL_ON.Click += new System.EventHandler(this.Power_OnOff_Set);
1397 1406
             // 
1398 1407
             // pictureBox_PATH_3_5G_UL_OFF
1399 1408
             // 
@@ -1403,6 +1412,7 @@
1403 1412
             this.pictureBox_PATH_3_5G_UL_OFF.Size = new System.Drawing.Size(38, 36);
1404 1413
             this.pictureBox_PATH_3_5G_UL_OFF.TabIndex = 96;
1405 1414
             this.pictureBox_PATH_3_5G_UL_OFF.TabStop = false;
1415
+            this.pictureBox_PATH_3_5G_UL_OFF.Click += new System.EventHandler(this.Power_OnOff_Set);
1406 1416
             // 
1407 1417
             // pictureBox_PATH_3_5G_DL_ON
1408 1418
             // 
@@ -1412,6 +1422,7 @@
1412 1422
             this.pictureBox_PATH_3_5G_DL_ON.Size = new System.Drawing.Size(38, 36);
1413 1423
             this.pictureBox_PATH_3_5G_DL_ON.TabIndex = 96;
1414 1424
             this.pictureBox_PATH_3_5G_DL_ON.TabStop = false;
1425
+            this.pictureBox_PATH_3_5G_DL_ON.Click += new System.EventHandler(this.Power_OnOff_Set);
1415 1426
             // 
1416 1427
             // pictureBox_PATH_3_5G_DL_OFF
1417 1428
             // 
@@ -1421,6 +1432,7 @@
1421 1432
             this.pictureBox_PATH_3_5G_DL_OFF.Size = new System.Drawing.Size(38, 36);
1422 1433
             this.pictureBox_PATH_3_5G_DL_OFF.TabIndex = 96;
1423 1434
             this.pictureBox_PATH_3_5G_DL_OFF.TabStop = false;
1435
+            this.pictureBox_PATH_3_5G_DL_OFF.Click += new System.EventHandler(this.Power_OnOff_Set);
1424 1436
             // 
1425 1437
             // pictureBox_PATH_2_1G_UL_ON
1426 1438
             // 
@@ -1430,6 +1442,7 @@
1430 1442
             this.pictureBox_PATH_2_1G_UL_ON.Size = new System.Drawing.Size(38, 36);
1431 1443
             this.pictureBox_PATH_2_1G_UL_ON.TabIndex = 96;
1432 1444
             this.pictureBox_PATH_2_1G_UL_ON.TabStop = false;
1445
+            this.pictureBox_PATH_2_1G_UL_ON.Click += new System.EventHandler(this.Power_OnOff_Set);
1433 1446
             // 
1434 1447
             // pictureBox_PATH_2_1G_UL_OFF
1435 1448
             // 
@@ -1439,6 +1452,7 @@
1439 1452
             this.pictureBox_PATH_2_1G_UL_OFF.Size = new System.Drawing.Size(38, 36);
1440 1453
             this.pictureBox_PATH_2_1G_UL_OFF.TabIndex = 96;
1441 1454
             this.pictureBox_PATH_2_1G_UL_OFF.TabStop = false;
1455
+            this.pictureBox_PATH_2_1G_UL_OFF.Click += new System.EventHandler(this.Power_OnOff_Set);
1442 1456
             // 
1443 1457
             // pictureBox_PATH_2_1G_DL_ON
1444 1458
             // 
@@ -1448,6 +1462,7 @@
1448 1462
             this.pictureBox_PATH_2_1G_DL_ON.Size = new System.Drawing.Size(38, 36);
1449 1463
             this.pictureBox_PATH_2_1G_DL_ON.TabIndex = 96;
1450 1464
             this.pictureBox_PATH_2_1G_DL_ON.TabStop = false;
1465
+            this.pictureBox_PATH_2_1G_DL_ON.Click += new System.EventHandler(this.Power_OnOff_Set);
1451 1466
             // 
1452 1467
             // pictureBox_PATH_2_1G_DL_OFF
1453 1468
             // 
@@ -1457,6 +1472,7 @@
1457 1472
             this.pictureBox_PATH_2_1G_DL_OFF.Size = new System.Drawing.Size(38, 36);
1458 1473
             this.pictureBox_PATH_2_1G_DL_OFF.TabIndex = 96;
1459 1474
             this.pictureBox_PATH_2_1G_DL_OFF.TabStop = false;
1475
+            this.pictureBox_PATH_2_1G_DL_OFF.Click += new System.EventHandler(this.Power_OnOff_Set);
1460 1476
             // 
1461 1477
             // pictureBox_PATH_1_8G_UL_ON
1462 1478
             // 
@@ -1466,6 +1482,7 @@
1466 1482
             this.pictureBox_PATH_1_8G_UL_ON.Size = new System.Drawing.Size(38, 36);
1467 1483
             this.pictureBox_PATH_1_8G_UL_ON.TabIndex = 96;
1468 1484
             this.pictureBox_PATH_1_8G_UL_ON.TabStop = false;
1485
+            this.pictureBox_PATH_1_8G_UL_ON.Click += new System.EventHandler(this.Power_OnOff_Set);
1469 1486
             // 
1470 1487
             // pictureBox_PATH_1_8G_UL_OFF
1471 1488
             // 
@@ -1475,6 +1492,7 @@
1475 1492
             this.pictureBox_PATH_1_8G_UL_OFF.Size = new System.Drawing.Size(38, 36);
1476 1493
             this.pictureBox_PATH_1_8G_UL_OFF.TabIndex = 96;
1477 1494
             this.pictureBox_PATH_1_8G_UL_OFF.TabStop = false;
1495
+            this.pictureBox_PATH_1_8G_UL_OFF.Click += new System.EventHandler(this.Power_OnOff_Set);
1478 1496
             // 
1479 1497
             // pictureBox_PATH_1_8G_DL_ON
1480 1498
             // 
@@ -1484,6 +1502,7 @@
1484 1502
             this.pictureBox_PATH_1_8G_DL_ON.Size = new System.Drawing.Size(38, 36);
1485 1503
             this.pictureBox_PATH_1_8G_DL_ON.TabIndex = 96;
1486 1504
             this.pictureBox_PATH_1_8G_DL_ON.TabStop = false;
1505
+            this.pictureBox_PATH_1_8G_DL_ON.Click += new System.EventHandler(this.Power_OnOff_Set);
1487 1506
             // 
1488 1507
             // pictureBox_PATH_1_8G_DL_OFF
1489 1508
             // 
@@ -1493,6 +1512,7 @@
1493 1512
             this.pictureBox_PATH_1_8G_DL_OFF.Size = new System.Drawing.Size(38, 36);
1494 1513
             this.pictureBox_PATH_1_8G_DL_OFF.TabIndex = 96;
1495 1514
             this.pictureBox_PATH_1_8G_DL_OFF.TabStop = false;
1515
+            this.pictureBox_PATH_1_8G_DL_OFF.Click += new System.EventHandler(this.Power_OnOff_Set);
1496 1516
             // 
1497 1517
             // label79
1498 1518
             // 
@@ -2043,7 +2063,6 @@
2043 2063
         private System.Windows.Forms.Label label3;
2044 2064
         private System.Windows.Forms.Label label2;
2045 2065
         private System.Windows.Forms.GroupBox groupBox17;
2046
-        private System.Windows.Forms.PictureBox pictureBox_G_TX;
2047 2066
         private System.Windows.Forms.Label label78;
2048 2067
         private System.Windows.Forms.Label label77;
2049 2068
         private System.Windows.Forms.Label label76;
@@ -2054,7 +2073,6 @@
2054 2073
         private System.Windows.Forms.Label label71;
2055 2074
         private System.Windows.Forms.Label label70;
2056 2075
         private System.Windows.Forms.Label label69;
2057
-        private System.Windows.Forms.PictureBox pictureBox_R_RX;
2058 2076
         private System.Windows.Forms.Label label79;
2059 2077
         private System.Windows.Forms.PictureBox pictureBox15;
2060 2078
         private System.Windows.Forms.Label label80;
@@ -2118,8 +2136,6 @@
2118 2136
         public System.Windows.Forms.PictureBox pictureBox_PATH_2_1G_DL_ON;
2119 2137
         public System.Windows.Forms.PictureBox pictureBox_PATH_1_8G_UL_ON;
2120 2138
         private System.Windows.Forms.GroupBox groupBox12;
2121
-        private System.Windows.Forms.PictureBox pictureBox_R_TX;
2122
-        private System.Windows.Forms.PictureBox pictureBox_G_RX;
2123 2139
         private System.Windows.Forms.GroupBox groupBox_TDD;
2124 2140
         private System.Windows.Forms.Label label24;
2125 2141
         private System.Windows.Forms.Label label22;
@@ -2127,6 +2143,10 @@
2127 2143
         private System.Windows.Forms.PictureBox pictureBox_TDD_T_SYNC_UL_OFF;
2128 2144
         private System.Windows.Forms.PictureBox pictureBox_TDD_T_SYNC_DL_ON;
2129 2145
         private System.Windows.Forms.PictureBox pictureBox_TDD_T_SYNC_UL_ON;
2146
+        public System.Windows.Forms.PictureBox pictureBox_G_TX;
2147
+        public System.Windows.Forms.PictureBox pictureBox_R_RX;
2148
+        public System.Windows.Forms.PictureBox pictureBox_R_TX;
2149
+        public System.Windows.Forms.PictureBox pictureBox_G_RX;
2130 2150
     }
2131 2151
 }
2132 2152
 

+ 78 - 3
Basic_Terminal/Wnd/Main_Form.cs

@@ -48,7 +48,7 @@ namespace RF_TRIO_PLL_ZIG
48 48
         {
49 49
             bool ret = false;
50 50
             ret = Serial_connectiondisable(serial.Serial_PortOpen(ref button_PortOpen, ref comboBox_Port));
51
-            if (ret == true && timer.Enabled == false)
51
+            if (ret == false && timer.Enabled == false)
52 52
             { 
53 53
                 timer.Start(); //타이머를 발동시킨다.
54 54
             }
@@ -60,6 +60,8 @@ namespace RF_TRIO_PLL_ZIG
60 60
             {
61 61
                 /*NOP*/
62 62
             }
63
+            serial.Serial_Main_Form_Get(this);
64
+            
63 65
 
64 66
         }
65 67
 
@@ -78,10 +80,39 @@ namespace RF_TRIO_PLL_ZIG
78 80
             comboBox_baudrate.Enabled = on_off;
79 81
             return on_off;
80 82
         }
81
-
83
+        private delegate void BoolSet();
84
+        
85
+        public void TX_Light_ON()
86
+        {
87
+            
88
+            this.pictureBox_G_TX.Visible = true;
89
+            this.pictureBox_R_TX.Visible = false;
90
+        }
91
+        public void TX_Light_OFF()
92
+        {
93
+            this.pictureBox_R_TX.Visible = true;
94
+            this.pictureBox_G_TX.Visible = false;
95
+        }
96
+        public void RX_Light_ON()
97
+        {
98
+            this.pictureBox_G_RX.Visible = true;
99
+            this.pictureBox_R_RX.Visible = false;
100
+        }
101
+        public void RX_Light_OFF()
102
+        {
103
+            this.pictureBox_R_RX.Visible = true;
104
+            this.pictureBox_G_RX.Visible = false;
105
+        }
82 106
         private void timer_Tick(object sender, EventArgs e)
83 107
         {
84
-
108
+            if (this.pictureBox_G_TX.Visible == true)
109
+            {
110
+                TX_Light_OFF();
111
+            }
112
+            if(this.pictureBox_G_RX.Visible == true)
113
+            {
114
+                RX_Light_OFF();
115
+            }
85 116
         }
86 117
 
87 118
         private void button_Set_Click(object sender, EventArgs e)
@@ -147,5 +178,49 @@ namespace RF_TRIO_PLL_ZIG
147 178
             pictureBox_TDD_T_SYNC_UL_ON.Visible = !pictureBox_TDD_T_SYNC_UL_ON.Visible;
148 179
             pictureBox_TDD_T_SYNC_DL_OFF.Visible = !pictureBox_TDD_T_SYNC_DL_OFF.Visible;
149 180
         }
181
+        const byte PATH_1_8G_DL = 0;
182
+        const byte PATH_1_8G_UL = 1;
183
+        const byte PATH_2_1G_DL = 2;
184
+        const byte PATH_2_1G_UL = 3;
185
+        const byte PATH_3_5G_DL = 4;
186
+        const byte PATH_3_5G_UL = 5;
187
+        const byte PATH_3_5G_H = 6;
188
+        const byte PATH_3_5G_L = 7;
189
+        const byte PLL_POWER_ONOFF_3_5G_H = 8;
190
+        const byte PLL_POWER_ONOFF_3_5G_L = 9;
191
+
192
+        private void Power_OnOff_Set(object sender, EventArgs e)
193
+        {
194
+            byte temp_tag = 0;
195
+            PictureBox pictureBox = (PictureBox)sender;
196
+            temp_tag = Convert.ToByte(pictureBox.Tag);
197
+            switch (temp_tag)
198
+            {
199
+                case PATH_1_8G_DL:
200
+                    break;
201
+                case PATH_1_8G_UL:
202
+                    break;
203
+                case PATH_2_1G_DL:
204
+                    break;
205
+                case PATH_2_1G_UL:
206
+                    break;
207
+                case PATH_3_5G_DL:
208
+                    break;
209
+                case PATH_3_5G_UL:
210
+                    break;
211
+                case PATH_3_5G_H:
212
+                    break;
213
+                case PATH_3_5G_L:
214
+                    break;
215
+                case PLL_POWER_ONOFF_3_5G_H:
216
+                    break;
217
+                case PLL_POWER_ONOFF_3_5G_L:
218
+                    break;
219
+
220
+
221
+            }
222
+            pictureBox.Visible = !pictureBox.Visible;
223
+            bluecell_BootProtocol.Bluecell_BtnSet(this.serial, this);
224
+        }
150 225
     }
151 226
 }