DELL
2025-04-28 e6eb7fb0af366e370f125668d62e89eb0004f517
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
package com.dev.bybb;
 
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.StringSelection;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.Vector;
 
import javax.swing.JButton;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.Timer;
import javax.swing.UIManager;
import javax.swing.border.TitledBorder;
import javax.swing.table.DefaultTableModel;
import javax.swing.JList;
import javax.swing.AbstractListModel;
import javax.swing.event.ListSelectionListener;
import javax.swing.event.ListSelectionEvent;
import javax.swing.JLabel;
import javax.swing.ListSelectionModel;
import javax.swing.SwingConstants;
 
import main.page_debug_inf;
 
import javax.swing.JCheckBox;
 
import java.awt.event.ItemListener;
import java.awt.event.ItemEvent;
import java.awt.FlowLayout;
 
import javax.swing.JTabbedPane;
 
public class bybb_page_sendudp extends JPanel {
    private JTable table_bybb_data;
    private Vector<String> columnVector;
    private Vector<Vector<String>> dataRow;
    
    private Vector<String> columnVectorCan;
    private Vector<Vector<String>> dataRowCan;
    
    private static final long serialVersionUID = 1L;
    private JTextField tf_dev_version;
    private JPanel panel;
    private JList<Object> list_datsel;
    private JLabel lbl_dataname;
    private JButton btn_send;
    private Timer mUdpTimer;
    
    public BYBB_Cmd m_BYBB_Cmd = new BYBB_Cmd();
    
    private String TarIP = null;
    private int TarIP_Port = 1000;
    private page_debug_inf dt_debug_inf;
    private JPanel panel_1;
    private JButton btn_gen_data;
    private JTextField tf_canIp;
    private JTextField tf_canPort;
    private JPanel panel_2;
    private JCheckBox ckb_auto_send;
    private JCheckBox ckb_auto_gen_data;
    private boolean m_table_isEdit = false;
    private JButton btn_send_ckcmd;
    
    private BYBB_UdpSender m_SendUdp;
    private UdpServBYBB m_UdpServBYBB; 
    private JPanel panel_3;
    private JCheckBox ckb_EthCapt1;
    private JCheckBox ckb_EthCapt2;
    private JCheckBox ckb_EthWgu1;
    private JCheckBox ckb_EthWgu2;
    private JCheckBox ckb_CanCpt1;
    private JCheckBox ckb_CanCpt2;
    private JCheckBox ckb_CanWgu1;
    private JCheckBox ckb_CanWgu2;
    private JCheckBox ckb_DEthLcu11;
    private JCheckBox ckb_DEthLcu12;
    private JCheckBox ckb_DEthLcu21;
    private JCheckBox ckb_DEthLcu22;
    private JCheckBox ckb_DCanLcu11;
    private JCheckBox ckb_DCanLcu12;
    private JCheckBox ckb_DCanLcu21;
    private JCheckBox ckb_DCanLcu22;
    private JPanel panel_4;
    private JButton btnNewButton;
    private JPanel panel_5;
    private JTabbedPane tabbedPane;
    private page_debug_inf panel_debug_UdpRx;
    private JPanel panel_6;
    
    /**
     * Create the panel.
     */
    public bybb_page_sendudp() {
        setLayout(new BorderLayout(0, 0));
        
        tabbedPane = new JTabbedPane(JTabbedPane.TOP);
        add(tabbedPane);
        panel = new JPanel();
        tabbedPane.addTab("\u4EFF\u771F\u6570\u636E\u53D1\u9001", null, panel, null);
        panel.setLayout(new BorderLayout(0, 0));
        
        JPanel panel_44 = new JPanel();
        panel.add(panel_44, BorderLayout.CENTER);
        panel_44.setLayout(new BorderLayout(0, 0));
        
        lbl_dataname = new JLabel("");
        lbl_dataname.setHorizontalAlignment(SwingConstants.CENTER);
        panel_44.add(lbl_dataname, BorderLayout.NORTH);
        
        JScrollPane scrollPane_2 = new JScrollPane();
        panel_44.add(scrollPane_2);
        
        table_bybb_data = new JTable();
        MouseAdapter m_a = new MouseAdapter() {
            public void mouseReleased(MouseEvent e) {
                if(e.getSource() != table_bybb_data) {
                    return;
                }
            }
            public void mousePressed(MouseEvent evt) {
                if (evt.getButton() == MouseEvent.BUTTON3) {
                    JPopupMenu popupMenu = new JPopupMenu();
                        JMenuItem tableItem_export_data = null;
                    
                    tableItem_export_data = new JMenuItem("¸´ÖƵ½¼ôÌù°å");
                    tableItem_export_data.addActionListener(new ActionListener(){
                        @Override
                        public void actionPerformed(ActionEvent arg0) {
                            Clipboard clipboard = getToolkit().getSystemClipboard();
                            String temp = "";
                            for(int c=0; c<columnVector.size(); c++)
                            {
                                temp += columnVector.get(c) + "\t";
                            }
                            temp += "\n";
                            for(int r=0; r<dataRow.size(); r++)
                            {
                                for(int c=0; c<columnVector.size(); c++)
                                {
                                    temp += dataRow.get(r).get(c) + "\t";
                                }
                                temp += "\n";
                            }
                            StringSelection text = new StringSelection(temp);
                            clipboard.setContents(text, null);
                        }
                    });
                    popupMenu.add(tableItem_export_data);
                    popupMenu.show(evt.getComponent(), evt.getX(), evt.getY());
                  }
            }
        };
        table_bybb_data.addMouseListener(m_a);
        scrollPane_2.setViewportView(table_bybb_data);
        
        panel_1 = new JPanel();
        FlowLayout flowLayout = (FlowLayout) panel_1.getLayout();
        flowLayout.setHgap(2);
        panel_44.add(panel_1, BorderLayout.SOUTH);
        
        btn_gen_data = new JButton("\u968F\u673A\u751F\u6210\u6570\u636E");
        btn_gen_data.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent arg0) {
                genRandomData(false);
            }
        });
        
        btn_send_ckcmd = new JButton("\u53D1\u9001\u81EA\u68C0\u547D\u4EE4");
        btn_send_ckcmd.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent arg0) {
                String can_ip = tf_canIp.getText();
                int can_port = 0;
                try {
                    can_port = Integer.parseInt(tf_canPort.getText());
                } catch (Exception e) {
                    JOptionPane.showMessageDialog(null, "ÇëÊäÈëÕýÈ·µÄ¶Ë¿ÚºÅ!");
                    return;
                }
                
                m_SendUdp.sendUsrDataEn();
                m_SendUdp.setManulSendEn(TarIP, TarIP_Port, can_ip, can_port, dt_debug_inf);
            }
        });
        panel_1.add(btn_send_ckcmd);
        
        btnNewButton = new JButton("\u6E05\u96F6\u6570\u636E");
        btnNewButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent arg0) {
                genRandomData(true);
            }
        });
        panel_1.add(btnNewButton);
        panel_1.add(btn_gen_data);
        
        panel_2 = new JPanel();
        panel_2.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "CanMaster IP / PORT", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
        panel_1.add(panel_2);
        panel_2.setLayout(new GridLayout(0, 2, 0, 0));
        
        tf_canIp = new JTextField();
        tf_canIp.setText("192.168.10.7");
        panel_2.add(tf_canIp);
        tf_canIp.setColumns(8);
        
        tf_canPort = new JTextField();
        tf_canPort.setText("20001");
        panel_2.add(tf_canPort);
        tf_canPort.setColumns(6);
        
        ckb_auto_gen_data = new JCheckBox("\u81EA\u52A8\u968F\u673A\u6570");
        panel_1.add(ckb_auto_gen_data);
        
        JPanel panel_57 = new JPanel();
        panel.add(panel_57, BorderLayout.EAST);
        panel_57.setLayout(new BorderLayout(0, 0));
        
        JPanel panel_58 = new JPanel();
        panel_57.add(panel_58, BorderLayout.CENTER);
        panel_58.setLayout(new GridLayout(0, 2, 0, 0));
        
        panel_4 = new JPanel();
        panel_4.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "\u6570\u636E\u663E\u793A\u9009\u62E9", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
        panel_58.add(panel_4);
        panel_4.setLayout(new BorderLayout(0, 0));
        
        list_datsel = new JList<Object>();
        panel_4.add(list_datsel);
        list_datsel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        list_datsel.addListSelectionListener(new ListSelectionListener() {
            public void valueChanged(ListSelectionEvent arg0) {
                int index = list_datsel.getSelectedIndex();
                if(index >= 0) {
                    ArrayList<byte[]> bb = m_SendUdp.getCanByteBuf(index);
                    if(bb.size() <= 1) {
                        updateData(bb.get(0));
                    } else {
                        updateData(bb);
                    }
                }
            }
        });
        list_datsel.setModel(new AbstractListModel<Object>() {
            /**
             * 
             */
            private static final long serialVersionUID = 1L;
            String[] values = new String[] {"View_EthCpt1", "View_EthCpt2", "View_EthWgu1", "View_EthWgu2", "View_CanCpt1", "View_CanCpt2", "View_CanWgu1", "View_CanWgu2", "View_DEthLcu11", "View_DEthLcu12", "View_DEthLcu21", "View_DEthLcu22", "View_DCanLcu11", "View_DCanLcu12", "View_DCanLcu21", "View_DCanLcu22"};
            public int getSize() {
                return values.length;
            }
            public Object getElementAt(int index) {
                return values[index];
            }
        });
        
        panel_6 = new JPanel();
        panel_58.add(panel_6);
        panel_6.setLayout(new BorderLayout(0, 0));
        
        panel_3 = new JPanel();
        panel_6.add(panel_3, BorderLayout.CENTER);
        panel_3.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "\u6570\u636E\u53D1\u9001\u9009\u62E9", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
        
        ItemListener ckb_Listener = new ItemListener() {
            public void itemStateChanged(ItemEvent arg0) {
                JCheckBox ckb = (JCheckBox) arg0.getSource();
                if(ckb.equals(ckb_EthCapt1)) {
                    m_SendUdp.setDataSendEn(0, ckb.isSelected());
                }
                if(ckb.equals(ckb_EthCapt2)) {
                    m_SendUdp.setDataSendEn(1, ckb.isSelected());
                }
                if(ckb.equals(ckb_EthWgu1)) {
                    m_SendUdp.setDataSendEn(2, ckb.isSelected());
                }
                if(ckb.equals(ckb_EthWgu2)) {
                    m_SendUdp.setDataSendEn(3, ckb.isSelected());
                }
                if(ckb.equals(ckb_CanCpt1)) {
                    m_SendUdp.setDataSendEn(4, ckb.isSelected());
                }
                if(ckb.equals(ckb_CanCpt2)) {
                    m_SendUdp.setDataSendEn(5, ckb.isSelected());
                }
                if(ckb.equals(ckb_CanWgu1)) {
                    m_SendUdp.setDataSendEn(6, ckb.isSelected());
                }
                if(ckb.equals(ckb_CanWgu2)) {
                    m_SendUdp.setDataSendEn(7, ckb.isSelected());
                }
                
                if(ckb.equals(ckb_DEthLcu11)) {
                    m_SendUdp.setDataSendEn(8, ckb.isSelected());
                }
                if(ckb.equals(ckb_DEthLcu12)) {
                    m_SendUdp.setDataSendEn(9, ckb.isSelected());
                }
                if(ckb.equals(ckb_DEthLcu21)) {
                    m_SendUdp.setDataSendEn(10, ckb.isSelected());
                }
                if(ckb.equals(ckb_DEthLcu22)) {
                    m_SendUdp.setDataSendEn(11, ckb.isSelected());
                }
                if(ckb.equals(ckb_DCanLcu11)) {
                    m_SendUdp.setDataSendEn(12, ckb.isSelected());
                }
                if(ckb.equals(ckb_DCanLcu12)) {
                    m_SendUdp.setDataSendEn(13, ckb.isSelected());
                }
                if(ckb.equals(ckb_DCanLcu21)) {
                    m_SendUdp.setDataSendEn(14, ckb.isSelected());
                }
                if(ckb.equals(ckb_DCanLcu22)) {
                    m_SendUdp.setDataSendEn(15, ckb.isSelected());
                }
            }
        };
        ckb_EthCapt1 = new JCheckBox("EthCapt1");
        ckb_EthCapt1.setBounds(6, 22, 110, 19);
        ckb_EthCapt1.addItemListener(ckb_Listener);
        panel_3.setLayout(null);
        panel_3.add(ckb_EthCapt1);
        
        ckb_EthCapt2 = new JCheckBox("EthCapt2");
        ckb_EthCapt2.setBounds(6, 41, 110, 19);
        ckb_EthCapt2.addItemListener(ckb_Listener);
        panel_3.add(ckb_EthCapt2);
        
        ckb_EthWgu1 = new JCheckBox("EthWgu1");
        ckb_EthWgu1.setBounds(6, 60, 110, 19);
        ckb_EthWgu1.addItemListener(ckb_Listener);
        panel_3.add(ckb_EthWgu1);
        
        ckb_EthWgu2 = new JCheckBox("EthWgu2");
        ckb_EthWgu2.setBounds(6, 79, 110, 19);
        ckb_EthWgu2.addItemListener(ckb_Listener);
        panel_3.add(ckb_EthWgu2);
        
        ckb_CanCpt1 = new JCheckBox("CanCpt1");
        ckb_CanCpt1.setBounds(6, 98, 110, 19);
        ckb_CanCpt1.addItemListener(ckb_Listener);
        panel_3.add(ckb_CanCpt1);
        
        ckb_CanCpt2 = new JCheckBox("CanCpt2");
        ckb_CanCpt2.setBounds(6, 117, 110, 19);
        ckb_CanCpt2.addItemListener(ckb_Listener);
        panel_3.add(ckb_CanCpt2);
        
        ckb_CanWgu1 = new JCheckBox("CanWgu1");
        ckb_CanWgu1.setBounds(6, 136, 110, 19);
        ckb_CanWgu1.addItemListener(ckb_Listener);
        panel_3.add(ckb_CanWgu1);
        
        ckb_CanWgu2 = new JCheckBox("CanWgu2");
        ckb_CanWgu2.setBounds(6, 155, 110, 19);
        ckb_CanWgu2.addItemListener(ckb_Listener);
        panel_3.add(ckb_CanWgu2);
        
        ckb_DEthLcu11 = new JCheckBox("DEthLcu11");
        ckb_DEthLcu11.setBounds(6, 174, 110, 19);
        ckb_DEthLcu11.addItemListener(ckb_Listener);
        panel_3.add(ckb_DEthLcu11);
        
        ckb_DEthLcu12 = new JCheckBox("DEthLcu12");
        ckb_DEthLcu12.setBounds(6, 193, 110, 19);
        ckb_DEthLcu12.addItemListener(ckb_Listener);
        panel_3.add(ckb_DEthLcu12);
        
        ckb_DEthLcu21 = new JCheckBox("DEthLcu21");
        ckb_DEthLcu21.setBounds(6, 212, 110, 19);
        ckb_DEthLcu21.addItemListener(ckb_Listener);
        panel_3.add(ckb_DEthLcu21);
        
        ckb_DEthLcu22 = new JCheckBox("DEthLcu22");
        ckb_DEthLcu22.setBounds(6, 231, 110, 19);
        ckb_DEthLcu22.addItemListener(ckb_Listener);
        panel_3.add(ckb_DEthLcu22);
        
        ckb_DCanLcu11 = new JCheckBox("DCanLcu11");
        ckb_DCanLcu11.setBounds(6, 250, 110, 19);
        ckb_DCanLcu11.addItemListener(ckb_Listener);
        panel_3.add(ckb_DCanLcu11);
        
        ckb_DCanLcu12 = new JCheckBox("DCanLcu12");
        ckb_DCanLcu12.setBounds(6, 269, 110, 19);
        ckb_DCanLcu12.addItemListener(ckb_Listener);
        panel_3.add(ckb_DCanLcu12);
        
        ckb_DCanLcu21 = new JCheckBox("DCanLcu21");
        ckb_DCanLcu21.setBounds(6, 288, 110, 19);
        ckb_DCanLcu21.addItemListener(ckb_Listener);
        panel_3.add(ckb_DCanLcu21);
        
        ckb_DCanLcu22 = new JCheckBox("DCanLcu22");
        ckb_DCanLcu22.setBounds(6, 307, 110, 19);
        ckb_DCanLcu22.addItemListener(ckb_Listener);
        panel_3.add(ckb_DCanLcu22);
        
        JPanel panel_38 = new JPanel();
        panel_57.add(panel_38, BorderLayout.NORTH);
        panel_38.setLayout(new GridLayout(0, 1, 0, 0));
        
        JPanel panel_47 = new JPanel();
        panel_47.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "\u53D1\u9001\u5230UDP\u7AEF\u53E3", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
        panel_38.add(panel_47);
        panel_47.setLayout(new GridLayout(0, 1, 8, 0));
        
        panel_5 = new JPanel();
        panel_47.add(panel_5);
        panel_5.setLayout(new GridLayout(0, 2, 0, 0));
        
        btn_send = new JButton("\u53D1\u9001");
        panel_5.add(btn_send);
        
        ckb_auto_send = new JCheckBox("\u81EA\u52A8\u53D1\u9001");
        ckb_auto_send.setHorizontalAlignment(SwingConstants.RIGHT);
        panel_5.add(ckb_auto_send);
        btn_send.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent arg0) {
                sendUdpData();
            }
        });
        
        tf_dev_version = new JTextField();
        tf_dev_version.setFont(new Font("Courier New", Font.PLAIN, 14));
        panel_47.add(tf_dev_version);
        tf_dev_version.setColumns(20);
        
        columnVector = new Vector<String>();
        columnVector.add("ÐкÅ");
        for(int n=0; n<10; n++) {
            columnVector.add("ÁÐ" + n);
        }
        dataRow = new Vector<Vector<String>>();
        
        columnVectorCan = new Vector<String>();
        columnVectorCan.add("ÐкÅ");
        for(int n=0; n<12; n++) {
            columnVectorCan.add("ÁÐ" + n);
        }
        dataRowCan = new Vector<Vector<String>>();
        
        panel_debug_UdpRx = new page_debug_inf();
        tabbedPane.addTab("·ÂÕæÊý¾Ý½ÓÊÕ", null, panel_debug_UdpRx, null);
        /**************************************************************************/
        m_SendUdp = new BYBB_UdpSender();
        /**************************************************************************/
        mUdpTimer = new Timer(1000, new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent arg0) {
                btn_gen_data.setEnabled(!ckb_auto_gen_data.isSelected());
                if(true == ckb_auto_gen_data.isSelected()) {
                    genRandomData(false);
                }
                
                btn_send.setEnabled(!ckb_auto_send.isSelected());
                if(true == ckb_auto_send.isSelected()) {
                    sendUdpData();
                }
            }
        });
        /**************************************************************************/
        
        setButttonState(false);
    }
    
    private void setTableModule(Vector<Vector<String>> data_row, Vector<String> colum) {
        table_bybb_data.setModel(new DefaultTableModel(data_row, colum){
            private static final long serialVersionUID = 1L;
            public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
                try {
                    String str = ((String) aValue).trim();
                    if((str.length()<1) || (str.length()>2)) {
                        throw new Exception();
                    }
                    Integer.parseInt((String) aValue, 16);
                    m_table_isEdit = true;
                } catch (Exception ex) {
                    javax.swing.JOptionPane.showMessageDialog(null, "Ö»ÄÜÊäÈë2λµÄ16½øÖÆÊý!");
                    return;
                }
                super.setValueAt(aValue, rowIndex, columnIndex);
                this.fireTableDataChanged();
            }
        });
    }
    
    private void genRandomData(boolean clear_dat) {
        int tab_sel_index = list_datsel.getSelectedIndex();
        
        BYBB_Data dat_t = new BYBB_Data();
        for(int sel_index=0; sel_index<16; sel_index++) {
            if(false == m_SendUdp.getDataSendEn(sel_index)) {
                continue;
            }
            
            ArrayList<byte[]> bfd = null;
            ArrayList<byte[]> dat = null;
            int data_start_index = 0;
            if((sel_index>=0) && (sel_index<=3)) {
                bfd = dat_t.makeEthData((short)0x0828);
                dat = m_SendUdp.getCanByteBuf(sel_index);
                data_start_index = 6;
            }
            if((sel_index>=8) && (sel_index<=11)) {
                bfd = dat_t.makeEthStatData((short)0x0828);
                dat = m_SendUdp.getCanByteBuf(sel_index);
                data_start_index = 6;
            }
            
            if ((sel_index>=4) && (sel_index<=7)) {
                bfd = dat_t.makeCanData();
                dat = m_SendUdp.getCanByteBuf(sel_index);
                data_start_index = 5;
            }
            if ((sel_index>=12) && (sel_index<=15)) {
                bfd = dat_t.makeCanStatData();
                dat = m_SendUdp.getCanByteBuf(sel_index);
                data_start_index = 5;
            }
            
            for(int n=0; n<bfd.size(); n++) {
                for(int col=data_start_index; col<bfd.get(n).length; col++) {
                    if(true == clear_dat) {
                        dat.get(n)[col] = 0;
                    } else {
                        dat.get(n)[col] = bfd.get(n)[col];
                    }
                }
            }
            if(tab_sel_index == sel_index) {
                if(null != dat) {
                    if(dat.size() <= 1) {
                        updateData(dat.get(0));
                    } else {
                        updateData(dat);
                    }
                }
            }
        }
    }
    
    private void sendUdpData() {
        int sel_index = list_datsel.getSelectedIndex();
        if(sel_index >= 0) {
            if((sel_index<=3) || ((sel_index>=8)&&(sel_index<=11))) {
                ArrayList<byte[]> dat_buf = m_SendUdp.getCanByteBuf(sel_index);
                if(null == dat_buf) {
                    return;
                }
                
                if(true == m_table_isEdit) {
                    m_table_isEdit = false;
                    for(int low_n=0; low_n<dataRow.size(); low_n++) {
                        for(int col_n=0; col_n<(columnVector.size()-1); col_n++) {
                            String str = dataRow.get(low_n).elementAt(col_n+1);
                            dat_buf.get(0)[low_n*10 + col_n] = (byte) Integer.parseInt(str, 16);
                        }
                    }
                }
            } else if(((sel_index>=4)&&(sel_index<=7)) || ((sel_index>=12)&&(sel_index<=15))) {
                ArrayList<byte[]> dat_buf = m_SendUdp.getCanByteBuf(sel_index);
                if(null == dat_buf) {
                    return;
                }
                
                if(true == m_table_isEdit) {
                    m_table_isEdit = false;
                    for(int low_n=0; low_n<dataRowCan.size(); low_n++) {
                        for(int col_n=5; col_n<columnVectorCan.size(); col_n++) {
                            String str = dataRowCan.get(low_n).elementAt(col_n);
                            dat_buf.get(low_n)[col_n] = (byte) Integer.parseInt(str, 16);
                        }
                    }
                }
            }
        }
        
        String can_ip = tf_canIp.getText();
        int can_port = 0;
        try {
            can_port = Integer.parseInt(tf_canPort.getText());
        } catch (Exception e) {
            JOptionPane.showMessageDialog(null, "ÇëÊäÈëÕýÈ·µÄ¶Ë¿ÚºÅ!");
            return;
        }
        if(null != m_SendUdp) {
            //m_SendUdp.setDataIndex(sel_index);
            m_SendUdp.setManulSendEn(TarIP, TarIP_Port, can_ip, can_port, dt_debug_inf);
        }
    }
    
    public void openCommPort(String ipaddr, int ipport, page_debug_inf dbg_inf) {
        TarIP = ipaddr;
        TarIP_Port = ipport;
        dt_debug_inf = dbg_inf;
        
        m_SendUdp.setDebugInfText(tf_dev_version, dt_debug_inf);
        Thread udpThread = new Thread(m_SendUdp);
        udpThread.start();
        
        m_UdpServBYBB = new UdpServBYBB (panel_debug_UdpRx);
        udpThread = new Thread(m_UdpServBYBB);
        udpThread.start();
    }
    
    public void closeCommPort() {
        if(null != m_SendUdp) {
            m_SendUdp.exitThread();
        }
        
        if(null != m_UdpServBYBB) {
            m_UdpServBYBB.exitThread();
        }
        m_UdpServBYBB = null;
        
        setButttonState(false);
    }
    
    public void setButttonState(boolean state) {
        btn_send.setEnabled(state);
        btn_send_ckcmd.setEnabled(state);
        if(true == state) {
            mUdpTimer.start();
        } else {
            mUdpTimer.stop();
        }
    }
 
    public void updateData(byte[] dat_show) {
        setTableModule(dataRow, columnVector);
        
        try{
            int low_cnt = dat_show.length/10;
            if(0 != (dat_show.length%10)) {
                low_cnt += 1;
            }
            if(dataRow.size() != low_cnt) {
                dataRow.clear();
                for(int low_n=0; low_n<low_cnt; low_n++) {
                    Vector<String> row = new Vector<String>();
                    row.addElement(String.format("%03d", low_n));
                    for(int col_n=0; col_n<columnVector.size(); col_n++) {
                        if((low_n*10 + col_n) < dat_show.length) {
                            row.addElement(String.format("%02X", dat_show[low_n*10 + col_n]));
                        } else {
                            row.addElement("");
                        }
                    }
                    dataRow.add(row);
                }
            } else {
                for(int low_n=0; low_n<low_cnt; low_n++) {
                    for(int col_n=0; col_n<(columnVector.size()-1); col_n++) {
                        if((low_n*10 + col_n) < dat_show.length) {
                            dataRow.get(low_n).setElementAt(String.format("%02X", dat_show[low_n*10 + col_n]), col_n+1);
                        }
                    }
                }
            }
            table_bybb_data.updateUI();
        } catch (Exception e) {
            e.printStackTrace();
            //JOptionPane.showMessageDialog(null, "updateData():" + e.getMessage());
        }
    }
    
    public void updateData(ArrayList<byte[]> dat_show) {
        setTableModule(dataRowCan, columnVectorCan);
        
        try{
            int low_cnt = dat_show.size();
            if(dataRowCan.size() != low_cnt) {
                dataRowCan.clear();
                for(int low_n=0; low_n<low_cnt; low_n++) {
                    Vector<String> row = new Vector<String>();
                    row.addElement(String.format("%03d", low_n));
                    byte[] b_dat = dat_show.get(low_n);
                    for(int col_n=1; col_n<b_dat.length; col_n++) {
                        row.addElement(String.format("%02X", b_dat[col_n]));
                    }
                    dataRowCan.add(row);
                }
            } else {
                for(int low_n=0; low_n<low_cnt; low_n++) {
                    byte[] b_dat = dat_show.get(low_n);
                    for(int col_n=1; col_n<b_dat.length; col_n++) {
                        dataRowCan.get(low_n).setElementAt(String.format("%02X", b_dat[col_n]), col_n);
                    }
                }
            }
            table_bybb_data.updateUI();
        } catch (Exception e) {
            e.printStackTrace();
            //JOptionPane.showMessageDialog(null, "updateData():" + e.getMessage());
        }
    }
}