whyclj
2021-01-05 64aba412c2b739d67795b14a3cae069d311697f9
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
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
package main;
import java.awt.EventQueue;
 
import javax.swing.JFrame;
 
import java.awt.Cursor;
import java.awt.Panel;
import java.awt.BorderLayout;
 
import javax.swing.JComboBox;
 
import java.awt.GridLayout;
 
import javax.swing.JPanel;
import javax.swing.border.TitledBorder;
import javax.swing.filechooser.FileFilter;
import javax.swing.JButton;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JFileChooser;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPopupMenu;
import javax.swing.Timer;
 
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.StringSelection;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.Toolkit;
 
import javax.swing.JTextField;
import javax.swing.UIManager;
 
import java.awt.Color;
import java.io.File;
import java.nio.ByteBuffer;
import java.util.Date;
import java.util.Vector;
 
import javax.swing.JTabbedPane;
import javax.swing.JScrollPane;
 
import java.awt.Font;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
 
import javax.swing.event.ChangeListener;
import javax.swing.event.ChangeEvent;
 
import com.Com;
import com.LimitedDocument;
import com.dev.fbs9100.FBS9100_ComBase;
import com.modbus.data.MyModbusMaster;
import com.sp_comm.SPCommFBS9100;
import com.teechart.TBarChart;
 
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
 
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
 
import javax.swing.BoxLayout;
import javax.swing.JTextArea;
 
public class main_window {
    public static final int  CommDevType_MON = 0;
    public static final int  CommDevType_ZDHJ = 1;
    public int CommDevType = CommDevType_MON;
    public int main_TabbedPane_SelIndex = 0;
    private JFrame frmSerialport;
    private JButton btn_connet;
    private JButton btn_break;
    private JComboBox<String> cb_commport;
    private SPCommFBS9100 SerialComm_FBS9100;
    private JTextField tf_target_addr;
    private JTextField tf_txcnt;
    private JTextField tf_rxcnt;
    
    private Timer mMainFormTimer = null;
    static private ByteBuffer DataBuffer = ByteBuffer.allocate(256); 
    private JTabbedPane main_TabbedPane;
    private JButton btn_renew_commport;
    
    private JTextField tf_slave_id;
    
    private JPanel panel_38;
    private JPanel panel_39;
    private JPanel panel_40;
    private JPanel panel_41;
    private JTextField tf_group_vol;
    private JTextField tf_group_curr;
    private JTextField tf_dev_temp;
    private JPanel panel_43;
    private JPanel panel_44;
    private JComboBox<String> comboBox;
    
    private JTabbedPane tab_panel_zdhj;
    private JPanel panel_ZDHJ;
    private JPanel panel_ZDHJ_Chart;
    private JPanel panel_ZDHJ_Param;
    private JPanel panel_ZDHJ_AutoSaveData;
    
    private JPanel panel_47;
    private JTextField tf_dev_version;
    private JTextField tf_dev_datetime;
    private JPanel panel_48;
    private JTextField tf_dev_moncount;
    private JPanel panel_49;
    private JPanel panel_51;
    private JTextField tf_zdhj_ch1_cnt;
    private JTextField tf_zdhj_ch2_cnt;
    private JTextField tf_zdhj_ch3_cnt;
    private JTextField tf_zdhj_ch4_cnt;
    private JTextField tf_zdhj_ch5_cnt;
    private JPanel panel_52;
    private JPanel panel_53;
    private JPanel panel_54;
    private JScrollPane scrollPane_2;
    
    private JTable table_zdhj_data;
    private Vector<String> columnVector;
    private Vector<Vector<String>> dataRow;
    public TBarChart m_TBarMonVolChart;
    public TBarChart m_TBarMonTmpChart;
    public TBarChart m_TBarMonResChart;
    
    private JTextField tf_zdhj_devaddr;
    private JTextField tf_zdhj_curr_range;
    private JTextField tf_zdhj_volcal_offset;
    private JTextField tf_zdhj_volcal_slope;
    private JTextField tf_zdhj_currcal_offset;
    private JTextField tf_zdhj_currcal_slope;
    private JButton btn_zdhj_volcal_offset;
    private JButton btn_zdhj_volcal_slope;
    private JButton tf_zdhj_volcal_reset;
    private JButton btn_zdhj_currcal_offset;
    private JButton btn_zdhj_currcal_slope;
    private JButton btn_zdhj_currcal_reset;
    private JButton btn_zdhj_param_read;
    private JButton btn_zdhj_param_write;
    private JButton btn_zdhj_restest_discharge;
    private JButton btn_zdhj_restest_lubo;
    private JPanel panel_monvol_chart;
    private JPanel panel_monres_chart;
    private JPanel panel_montmp_chart;
    private JTextField tf_zdhj_autores_interval;
    private JTextField tf_zdhj_wenbo_curr_lev;
    private JPanel panel_42;
    private JTextField tf_op_rest_inf;
    private JButton btn_zdhj_restest_auto;
    private JComboBox<String> cb_zdhj_res_testtype;
    private JPanel panel_45;
    private JTextField tf_param_set_inf;
    private JPanel panel_46;
    private JPanel panel_50;
    private JPanel panel_55;
    private JPanel panel_56;
    private JPanel panel_57;
    private JPanel panel_58;
    private JPanel panel_59;
    private JButton btn_zdhj_new_savefile;
    private JButton btn_zdhj_start_record;
    private JButton btn_zdhj_stop_record;
    private JTextField tf_zdhj_dfu_filename;
    private JFileChooser parseDir = new JFileChooser();
    private JPanel panel_60;
    private JPanel panel_61;
    private JTextField tf_zdhj_record_state;
    private JTextField tf_batt_state;
    private JTextField tf_online_vol;
    private JScrollPane scrollPane;
    private JTextArea ta_task_list;
    
    
    public static Logger logger = null;
    public static MyModbusMaster mymaster = null;
    
    
    static{        
        System.setProperty("log4j.configurationFile", "log4j2_modbus_tester.xml");
    }
    
    /**
     * Launch the application.
     */
    public static void main(String[] args) {
        
        logger = LogManager.getLogger(main_window.class);
        EventQueue.invokeLater(new Runnable() {
            public void run() {
                try {
                    main_window window = new main_window();
                    window.frmSerialport.setVisible(true);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
    }
 
    /**
     * Create the application.
     */
    public main_window() {
        initialize();
    }
 
    /**
     * Initialize the contents of the frame.
     */
    @SuppressWarnings({ "unchecked", "rawtypes" })
    private void initialize() {
        frmSerialport = new JFrame();
        //frmSerialport.setResizable(false);
        frmSerialport.setTitle("MyModBus-TESTER_V1.00");
        frmSerialport.setIconImage(Toolkit.getDefaultToolkit().getImage(main_window.class.getResource("/main/uis.png")));
        frmSerialport.setBounds(100, 100, 1105, 770);
        frmSerialport.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frmSerialport.setLocationRelativeTo(null);
        
        Panel panel = new Panel();
        frmSerialport.getContentPane().add(panel, BorderLayout.NORTH);
        panel.setLayout(new GridLayout(0, 4, 0, 0));
        
        JPanel panel_8 = new JPanel();
        panel_8.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "IPµØÖ·", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
        //panel_8.setFont(arg0);
        panel_8.setFont(new Font("ËÎÌå", Font.PLAIN, 12));
        panel.add(panel_8);
        panel_8.setLayout(new GridLayout(0, 1, 0, 0));
        
        tf_target_addr = new JTextField();
        tf_target_addr.addFocusListener(new FocusAdapter() {
            @Override
            public void focusLost(FocusEvent e) {
                if(tf_target_addr.getText().trim().length() < 1) {
                    tf_target_addr.setText("127.0.0.1");
                }
            }
        });
        tf_target_addr.setDocument(new LimitedDocument(15, "0123456789."));
        tf_target_addr.setText("127.0.0.1");
        panel_8.add(tf_target_addr);
        tf_target_addr.setColumns(10);
        
        comboBox = new JComboBox();
        comboBox.setModel(new DefaultComboBoxModel(new String[] {"9600", "19200", "38400", "57600", "115200"}));
        comboBox.setSelectedIndex(4);
        //panel_8.add(comboBox);
        
        JPanel panel_1 = new JPanel();
        panel_1.setBorder(new TitledBorder(null, "Slave ID", TitledBorder.LEADING, TitledBorder.TOP, null, null));
        panel.add(panel_1);
        
        cb_commport = new JComboBox<String>();
        if(cb_commport.getItemCount() > 0) {
            cb_commport.setSelectedIndex(0);
        }
        panel_1.setLayout(new GridLayout(0, 1, 0, 0));
        
        //slave ID
        tf_slave_id = new JTextField();
        tf_slave_id.addFocusListener(new FocusAdapter() {
            @Override
            public void focusLost(FocusEvent e) {
                if(tf_slave_id.getText().trim().length() < 1) {
                    tf_slave_id.setText("127.0.0.1");
                }
            }
        });
        tf_slave_id.setDocument(new LimitedDocument(1, "123456789"));
        tf_slave_id.setText("2");
        panel_1.add(tf_slave_id);
        tf_slave_id.setColumns(10);
        
        btn_renew_commport = new JButton("\u5237\u65B0");
        btn_renew_commport.setFont(new Font("ËÎÌå", Font.PLAIN, 12));
        btn_renew_commport.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent arg0) {
                SPCommFBS9100.searchCommPort(cb_commport);
                if(cb_commport.getItemCount() > 0) {
                    cb_commport.setSelectedIndex(0);
                }
            }
        });
        //panel_1.add(btn_renew_commport);
        //panel_1.add(cb_commport);
        
        JPanel panel_2 = new JPanel();
        panel_2.setBorder(new TitledBorder(null, "²Ù×÷", TitledBorder.LEADING, TitledBorder.TOP, null, null));
        panel.add(panel_2);
        
        btn_connet = new JButton("Á¬½Ó");
        btn_connet.setFont(new Font("ËÎÌå", Font.PLAIN, 12));
        btn_connet.setEnabled(true);
        btn_connet.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent arg0) {
                if(cb_commport.getSelectedIndex() < 0) {
                    Toolkit.getDefaultToolkit().beep();
                    JOptionPane.showMessageDialog(frmSerialport, "ÕÒ²»µ½Èκδ®¿Ú!");
                    return;
                }
                String str = cb_commport.getSelectedItem().toString();
                main_TabbedPane_SelIndex = main_TabbedPane.getSelectedIndex();
                boolean comm_open_res = true;
                int bit_rate = Integer.parseInt((String)comboBox.getSelectedItem());
                {
                    SerialComm_FBS9100 = new SPCommFBS9100((short) Integer.parseInt(tf_target_addr.getText().trim()), bit_rate);
                    if(true == SerialComm_FBS9100.OpenCommPort(str)) {
                        CommDevType = CommDevType_ZDHJ;
                        Thread spcommThread = new Thread(SerialComm_FBS9100);
                        spcommThread.start();
                    } else {
                        comm_open_res = false;
                    }
                }
                
                if(true == comm_open_res) {
                    main_TabbedPane.setEnabled(false);
                    tf_target_addr.setEditable(false);
                    btn_renew_commport.setEnabled(false);
                    cb_commport.setEnabled(false);
                    btn_connet.setEnabled(false);
                    btn_break.setEnabled(true);
                    
                    btn_zdhj_restest_discharge.setEnabled(true);
                    btn_zdhj_restest_lubo.setEnabled(true);
                    btn_zdhj_restest_auto.setEnabled(true);
                    btn_zdhj_param_read.setEnabled(true);
                    btn_zdhj_param_write.setEnabled(true);
                    
                    btn_zdhj_new_savefile.setEnabled(true);
                    btn_zdhj_start_record.setEnabled(true);
                    btn_zdhj_stop_record.setEnabled(true);
                    
                    mMainFormTimer.start();
                } else {
                    Toolkit.getDefaultToolkit().beep();
                    JOptionPane.showMessageDialog(frmSerialport, str + "²»´æÔÚ»ò±»ÆäËûÓ¦ÓóÌÐòÕ¼ÓÃ!");
                }
            }
        });
        panel_2.setLayout(new GridLayout(0, 2, 0, 0));
        panel_2.add(btn_connet);
        
        btn_break = new JButton("\u65AD\u5F00");
        btn_break.setFont(new Font("ËÎÌå", Font.PLAIN, 12));
        panel_2.add(btn_break);
        btn_break.setEnabled(false);
        btn_break.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent arg0) {
                System.out.println("¹Ø±Õ´®¿Ú");
                mMainFormTimer.stop();
                if(null != SerialComm_FBS9100) {
                    SerialComm_FBS9100.CloseCommPort();
                }
                tf_target_addr.setEditable(true);
                btn_renew_commport.setEnabled(true);
                cb_commport.setEnabled(true);
                btn_connet.setEnabled(true);
                btn_break.setEnabled(false);
                
                btn_zdhj_restest_discharge.setEnabled(false);
                btn_zdhj_restest_lubo.setEnabled(false);
                btn_zdhj_restest_auto.setEnabled(false);
                
                btn_zdhj_param_read.setEnabled(false);
                btn_zdhj_param_write.setEnabled(false);
                
                btn_zdhj_new_savefile.setEnabled(false);
                btn_zdhj_start_record.setEnabled(false);
                btn_zdhj_stop_record.setEnabled(false);
                
                main_TabbedPane.setEnabled(true);
            }
        });
        
        JPanel panel_9 = new JPanel();
        panel_9.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "\u901A\u4FE1\u8BA1\u6570(TX / RX)", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
        panel.add(panel_9);
        panel_9.setLayout(new GridLayout(0, 2, 0, 0));
        
        tf_txcnt = new JTextField();
        panel_9.add(tf_txcnt);
        tf_txcnt.setColumns(10);
        
        tf_rxcnt = new JTextField();
        panel_9.add(tf_rxcnt);
        tf_rxcnt.setColumns(10);
        tab_panel_zdhj = new JTabbedPane(JTabbedPane.TOP);
        
        main_TabbedPane = new JTabbedPane(JTabbedPane.TOP);
        main_TabbedPane.addChangeListener(new ChangeListener() {
            public void stateChanged(ChangeEvent arg0) {
                /*
                if(null != SerialComm_Mon) {
                    SerialComm_Mon.setNormalCommState(1!=main_TabbedPane.getSelectedIndex());
                }
                */
            }
        });
        frmSerialport.getContentPane().add(main_TabbedPane, BorderLayout.CENTER);
        /**************************************************************************/
        panel_ZDHJ = new JPanel();
        main_TabbedPane.add("MODBUS TCP Ä£¿é", tab_panel_zdhj);
        tab_panel_zdhj.add("01 Coils(0x)", panel_ZDHJ);
        panel_ZDHJ.setVisible(false);
        panel_ZDHJ.setLayout(new BorderLayout(0, 0));
        
        panel_43 = new JPanel();
        panel_ZDHJ.add(panel_43);
        panel_43.setLayout(new GridLayout(2, 1, 4, 0));
        
        panel_44 = new JPanel();
        panel_44.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Êý¾ÝÇøÓò", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
        panel_43.add(panel_44);
        panel_44.setLayout(new BorderLayout(1, 9));
        
        
        JScrollPane scrollPane_9 = new JScrollPane();
        panel_44.add(scrollPane_9);
        Vector thead_dataRow = new Vector<Vector<String>>();
        JTable thead_zdhj_data = new JTable();
        thead_zdhj_data.setModel(new DefaultTableModel(thead_dataRow, columnVector));
        
        scrollPane_2 = new JScrollPane();
        panel_44.add(scrollPane_2);
        
        table_zdhj_data = new JTable();
        columnVector = new Vector<String>();
        columnVector.add("0");
        columnVector.add("1");
        columnVector.add("2");
        columnVector.add("3");
        columnVector.add("4");
        columnVector.add("5");
        columnVector.add("6");
        columnVector.add("7");
        columnVector.add("8");
        columnVector.add("9");
        
        dataRow = new Vector<Vector<String>>();
        table_zdhj_data.setModel(new DefaultTableModel(dataRow, columnVector));
        MouseAdapter m_a = new MouseAdapter() {
            public void mouseReleased(MouseEvent e) {
                if(e.getSource() != table_zdhj_data) {
                    return;
                }
                /*
                int selectColumn = m_JTable.columnAtPoint(e.getPoint());
                int selectRow = m_JTable.rowAtPoint(e.getPoint());
                if (selectColumn == mCheckBoxColnumIndex) {
                    boolean value = (boolean) m_JTable.getValueAt(selectRow, selectColumn);
                    m_UI_Monit.m_MonLineChart.getSeries(selectRow+1).setVisible(!value);
                }
                */
            }
            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 = frmSerialport.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_zdhj_data.addMouseListener(m_a);
        scrollPane_2.setViewportView(table_zdhj_data);
        
        panel_57 = new JPanel();
        panel_43.add(panel_57);
        panel_57.setLayout(new BorderLayout(0, 0));
        
        panel_38 = new JPanel();
        panel_57.add(panel_38, BorderLayout.CENTER);
        //panel_ZDHJ.add(panel_38, BorderLayout.NORTH);
        panel_38.setLayout(new GridLayout(4, 2, 0, 0));
        
        panel_47 = new JPanel();
        panel_47.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "\u6A21\u5757\u7248\u672C", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
        panel_38.add(panel_47);
        panel_47.setLayout(new GridLayout(0, 1, 8, 0));
        
        tf_dev_version = new JTextField();
        panel_47.add(tf_dev_version);
        tf_dev_version.setColumns(10);
        
        panel_46 = new JPanel();
        panel_38.add(panel_46);
        panel_46.setBorder(new TitledBorder(null, "\u5355\u4F53\u603B\u6570", TitledBorder.LEADING, TitledBorder.TOP, null, null));
        panel_46.setLayout(new BorderLayout(0, 0));
        
        tf_dev_moncount = new JTextField();
        panel_46.add(tf_dev_moncount);
        tf_dev_moncount.setColumns(10);
        
        panel_39 = new JPanel();
        panel_39.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "\u7EC4\u7AEF\u7535\u538B(V) ", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
        panel_38.add(panel_39);
        panel_39.setLayout(new GridLayout(0, 1, 8, 0));
        
        tf_group_vol = new JTextField();
        panel_39.add(tf_group_vol);
        tf_group_vol.setColumns(10);
        
        panel_50 = new JPanel();
        panel_50.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "\u5728\u7EBF\u7535\u538B(V)", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
        panel_38.add(panel_50);
        panel_50.setLayout(new BorderLayout(0, 0));
        
        tf_online_vol = new JTextField();
        panel_50.add(tf_online_vol, BorderLayout.CENTER);
        tf_online_vol.setColumns(10);
        
        panel_40 = new JPanel();
        panel_40.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "\u7EC4\u7AEF\u7535\u6D41(A)", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
        panel_38.add(panel_40);
        panel_40.setLayout(new GridLayout(0, 1, 8, 0));
        
        tf_group_curr = new JTextField();
        panel_40.add(tf_group_curr);
        tf_group_curr.setColumns(10);
        
        panel_55 = new JPanel();
        panel_55.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "\u7535\u6C60\u72B6\u6001", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
        panel_38.add(panel_55);
        panel_55.setLayout(new BorderLayout(0, 0));
        
        tf_batt_state = new JTextField();
        panel_55.add(tf_batt_state, BorderLayout.CENTER);
        tf_batt_state.setColumns(10);
        
        panel_41 = new JPanel();
        panel_41.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "\u8BBE\u5907\u6E29\u5EA6(\u2103)", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
        panel_38.add(panel_41);
        panel_41.setLayout(new GridLayout(0, 1, 8, 0));
        
        tf_dev_temp = new JTextField();
        panel_41.add(tf_dev_temp);
        tf_dev_temp.setColumns(10);
        
        panel_56 = new JPanel();
        panel_56.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "\u8BBE\u5907\u65F6\u95F4(y-Y-d hh:mm:ss)", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
        panel_38.add(panel_56);
        panel_56.setLayout(new BorderLayout(0, 0));
        
        tf_dev_datetime = new JTextField();
        panel_56.add(tf_dev_datetime);
        tf_dev_datetime.setColumns(10);
        
        panel_58 = new JPanel();
        panel_57.add(panel_58, BorderLayout.SOUTH);
        panel_58.setLayout(new GridLayout(2, 1, 0, 0));
        
        panel_45 = new JPanel();
        panel_58.add(panel_45);
        panel_45.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "\u653E\u7535\u6D4B\u8BD5", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
        panel_45.setLayout(new GridLayout(0, 3, 4, 0));
        btn_zdhj_restest_discharge = new JButton("\u653E\u7535");
        btn_zdhj_restest_discharge.setEnabled(false);
        btn_zdhj_restest_discharge.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                SerialComm_FBS9100.setCommCmd(FBS9100_ComBase.CMD_StartDischarge, ByteBuffer.allocate(0));
            }
        });
        btn_zdhj_restest_discharge.setFont(new Font("ËÎÌå", Font.PLAIN, 12));
        panel_45.add(btn_zdhj_restest_discharge);
        
        btn_zdhj_restest_lubo = new JButton("\u5F55\u6CE2");
        btn_zdhj_restest_lubo.setEnabled(false);
        btn_zdhj_restest_lubo.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                short[] res_type_tag = new short[1];
                res_type_tag[0] = (short) 0x0000;
                //SerialComm_ZDHJ.setCommCmd(SPCommFBS9100.CMD_TYPE_WRITE, SPCommFBS9100.ZDHJ_ResTest_LUBO_RegAddr, 
                //                            res_type_tag, res_type_tag.length);
            }
        });
        btn_zdhj_restest_lubo.setFont(new Font("ËÎÌå", Font.PLAIN, 12));
        panel_45.add(btn_zdhj_restest_lubo);
        
        btn_zdhj_restest_auto = new JButton("\u81EA\u52A8");
        btn_zdhj_restest_auto.setEnabled(false);
        btn_zdhj_restest_auto.setFont(new Font("ËÎÌå", Font.PLAIN, 12));
        btn_zdhj_restest_auto.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                SerialComm_FBS9100.setCommCmd(FBS9100_ComBase.CMD_Stop, ByteBuffer.allocate(0));
            }
        });
        panel_45.add(btn_zdhj_restest_auto);
        
        tf_op_rest_inf = new JTextField();
        tf_op_rest_inf.setColumns(10);
        panel_42 = new JPanel();
        panel_58.add(panel_42);
        panel_42.setBorder(new TitledBorder(null, "\u64CD\u4F5C\u7ED3\u679C\u4FE1\u606F", TitledBorder.LEADING, TitledBorder.TOP, null, null));
        panel_42.setLayout(new BorderLayout(0, 0));
        panel_42.add(tf_op_rest_inf, BorderLayout.CENTER);
        
        /**************************************************************************/
//        panel_ZDHJ_Chart = new JPanel();
//        tab_panel_zdhj.add("02 Inputs(1x)", panel_ZDHJ_Chart);
//        panel_ZDHJ_Chart.setLayout(new GridLayout(3, 1, 0, 0));
//        
//        panel_monvol_chart = new JPanel();
//        panel_monvol_chart.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "\u5355\u4F53\u7535\u538B(V)", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
//        panel_monvol_chart.setLayout(new BorderLayout(0, 0));
//        m_TBarMonVolChart = new TBarChart(TBarChart.Bar_Type_MonVol);
//        panel_monvol_chart.add(m_TBarMonVolChart, BorderLayout.CENTER);
//        panel_ZDHJ_Chart.add(panel_monvol_chart);
//        
//        panel_monres_chart = new JPanel();
//        panel_monres_chart.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "\u5355\u4F53\u5185\u963B(m\u03A9)", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
//        panel_monres_chart.setLayout(new BorderLayout(0, 0));
//        m_TBarMonResChart = new TBarChart(TBarChart.Bar_Type_MonRes);
//        panel_monres_chart.add(m_TBarMonResChart, BorderLayout.CENTER);
//        panel_ZDHJ_Chart.add(panel_monres_chart);
//        
//        panel_montmp_chart = new JPanel();
//        panel_montmp_chart.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "\u5355\u4F53\u6E29\u5EA6(\u2103)", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
//        panel_montmp_chart.setLayout(new BorderLayout(0, 0));
//        m_TBarMonTmpChart = new TBarChart(TBarChart.Bar_Type_MonTmp);
//        panel_montmp_chart.add(m_TBarMonTmpChart, BorderLayout.CENTER);
//        panel_ZDHJ_Chart.add(panel_montmp_chart);
//        /**************************************************************************/
//        panel_ZDHJ_Param = new JPanel();
//        tab_panel_zdhj.add("03 Holding(4x)", panel_ZDHJ_Param);
//        panel_ZDHJ_Param.setLayout(new GridLayout(0, 1, 0, 0));
//        panel_48 = new JPanel();
//        panel_48.setBorder(new TitledBorder(null, "\u6A21\u5757\u53C2\u6570", TitledBorder.LEADING, TitledBorder.TOP, null, null));
//        panel_ZDHJ_Param.add(panel_48);
//        panel_48.setLayout(new GridLayout(5, 1, 0, 0));
//        
//        panel_49 = new JPanel();
//        panel_49.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "\u6A21\u5757\u5730\u5740 / \u7535\u6D41\u91CF\u7A0B(A) / \u5185\u963B\u5468\u671F(H) / \u653E\u7535\u9600\u503C(A) / \u5185\u963B\u7C7B\u578B", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
//        panel_48.add(panel_49);
//        panel_49.setLayout(new GridLayout(0, 5, 4, 0));
//        
//        tf_zdhj_devaddr = new JTextField();
//        tf_zdhj_devaddr.setDocument(new LimitedDocument(1, "0123456789"));
//        panel_49.add(tf_zdhj_devaddr);
//        tf_zdhj_devaddr.setColumns(10);
//        
//        tf_zdhj_curr_range = new JTextField();
//        tf_zdhj_curr_range.setDocument(new LimitedDocument(4, "0123456789"));
//        panel_49.add(tf_zdhj_curr_range);
//        tf_zdhj_curr_range.setColumns(10);
//        
//        tf_zdhj_autores_interval = new JTextField();
//        tf_zdhj_autores_interval.setDocument(new LimitedDocument(4, "0123456789"));
//        panel_49.add(tf_zdhj_autores_interval);
//        tf_zdhj_autores_interval.setColumns(10);
//        
//        tf_zdhj_wenbo_curr_lev = new JTextField();
//        tf_zdhj_wenbo_curr_lev.setDocument(new LimitedDocument(4, "0123456789."));
//        panel_49.add(tf_zdhj_wenbo_curr_lev);
//        tf_zdhj_wenbo_curr_lev.setColumns(10);
//        
//        cb_zdhj_res_testtype = new JComboBox();
//        cb_zdhj_res_testtype.setModel(new DefaultComboBoxModel(new String[] {"\u653E\u7535", "\u5F55\u6CE2", "\u81EA\u52A8"}));
//        cb_zdhj_res_testtype.setSelectedIndex(0);
//        panel_49.add(cb_zdhj_res_testtype);
//        
//        panel_51 = new JPanel();
//        panel_51.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), " 5 \u8DEF\u5355\u4F53\u901A\u9053\u5404\u81EA\u5355\u4F53\u6570(1/2/3/4/5)", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
//        panel_48.add(panel_51);
//        panel_51.setLayout(new GridLayout(0, 5, 4, 0));
//        
//        tf_zdhj_ch1_cnt = new JTextField();
//        panel_51.add(tf_zdhj_ch1_cnt);
//        tf_zdhj_ch1_cnt.setColumns(10);
//        
//        tf_zdhj_ch2_cnt = new JTextField();
//        panel_51.add(tf_zdhj_ch2_cnt);
//        tf_zdhj_ch2_cnt.setColumns(10);
//        
//        tf_zdhj_ch3_cnt = new JTextField();
//        panel_51.add(tf_zdhj_ch3_cnt);
//        tf_zdhj_ch3_cnt.setColumns(10);
//        
//        tf_zdhj_ch4_cnt = new JTextField();
//        panel_51.add(tf_zdhj_ch4_cnt);
//        tf_zdhj_ch4_cnt.setColumns(10);
//        
//        tf_zdhj_ch5_cnt = new JTextField();
//        panel_51.add(tf_zdhj_ch5_cnt);
//        tf_zdhj_ch5_cnt.setColumns(10);
//        
//        panel_54 = new JPanel();
//        panel_54.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "\u53C2\u6570\u8BBE\u7F6E", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
//        panel_48.add(panel_54);
//        
//        btn_zdhj_param_read = new JButton("\u8BFB\u53D6");
//        btn_zdhj_param_read.setEnabled(false);
//        btn_zdhj_param_read.addActionListener(new ActionListener() {
//            public void actionPerformed(ActionEvent e) {
//                SerialComm_FBS9100.setCommCmd(FBS9100_ComBase.CMD_GetBattParam, ByteBuffer.allocate(0));
//            }
//        });
//        panel_54.setLayout(new BorderLayout(0, 0));
//        btn_zdhj_param_read.setFont(new Font("ËÎÌå", Font.PLAIN, 12));
//        panel_54.add(btn_zdhj_param_read, BorderLayout.WEST);
//        
//        btn_zdhj_param_write = new JButton("\u8BBE\u7F6E");
//        btn_zdhj_param_write.setEnabled(false);
//        btn_zdhj_param_write.addActionListener(new ActionListener() {
//            public void actionPerformed(ActionEvent e) {
//                short[] zdhj_param_data = new short[11];
//                try {
//                    zdhj_param_data[0] = (short) Integer.parseInt(tf_zdhj_devaddr.getText());
//                    
//                    zdhj_param_data[1] = (short) Integer.parseInt(tf_zdhj_ch1_cnt.getText());
//                    zdhj_param_data[2] = (short) Integer.parseInt(tf_zdhj_ch2_cnt.getText());
//                    zdhj_param_data[3] = (short) Integer.parseInt(tf_zdhj_ch3_cnt.getText());
//                    zdhj_param_data[4] = (short) Integer.parseInt(tf_zdhj_ch4_cnt.getText());
//                    zdhj_param_data[5] = (short) Integer.parseInt(tf_zdhj_ch5_cnt.getText());
//                    
//                    zdhj_param_data[6] = (short) Integer.parseInt(tf_zdhj_curr_range.getText());
//                    zdhj_param_data[7] = 0;    //±£Áô
//                    zdhj_param_data[8] = (short) (Double.parseDouble(tf_zdhj_wenbo_curr_lev.getText())*100);
//                    zdhj_param_data[9] = (short) Integer.parseInt(tf_zdhj_autores_interval.getText());
//                    zdhj_param_data[10] = (short) cb_zdhj_res_testtype.getSelectedIndex();
//                    //--------------------------------------------------------------------------------//
//                    frmSerialport.setCursor(new Cursor(Cursor.WAIT_CURSOR));
//                    //SerialComm_ZDHJ.setCommCmd(SPCommFBS9100.CMD_TYPE_WRITE_MULTY, SPCommFBS9100.ZDHJ_PARAM_RegAddr_Start, 
//                    //                            zdhj_param_data, zdhj_param_data.length);
//                    Thread.sleep(1000);
//                    //SerialComm_ZDHJ.setCommCmd(SPCommFBS9100.CMD_TYPE_READ, SPCommFBS9100.ZDHJ_PARAM_RegAddr_Start, null, 0);
//                    frmSerialport.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
//                    //--------------------------------------------------------------------------------//
//                } catch (Exception e1) {
//                    JOptionPane.showMessageDialog(null, "ÇëÊäÈëºÏ·¨µÄ 'Ä£¿é²ÎÊý' Öµ!");
//                }
//            }
//        });
//        btn_zdhj_param_write.setFont(new Font("ËÎÌå", Font.PLAIN, 12));
//        panel_54.add(btn_zdhj_param_write, BorderLayout.EAST);
//        
//        tf_param_set_inf = new JTextField();
//        panel_54.add(tf_param_set_inf);
//        tf_param_set_inf.setColumns(10);
//        
//        panel_52 = new JPanel();
//        panel_52.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "\u7535\u538B\u6821\u51C6(\u504F\u79FB\u91CF / \u659C\u7387)", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
//        panel_48.add(panel_52);
//        panel_52.setLayout(new GridLayout(0, 5, 4, 0));
//        
//        tf_zdhj_volcal_offset = new JTextField();
//        panel_52.add(tf_zdhj_volcal_offset);
//        tf_zdhj_volcal_offset.setColumns(10);
//        
//        tf_zdhj_volcal_slope = new JTextField();
//        panel_52.add(tf_zdhj_volcal_slope);
//        tf_zdhj_volcal_slope.setColumns(10);
//        
//        btn_zdhj_volcal_offset = new JButton("\u504F\u79FB");
//        btn_zdhj_volcal_offset.setFont(new Font("ËÎÌå", Font.PLAIN, 12));
//        panel_52.add(btn_zdhj_volcal_offset);
//        
//        btn_zdhj_volcal_slope = new JButton("\u659C\u7387");
//        btn_zdhj_volcal_slope.setFont(new Font("ËÎÌå", Font.PLAIN, 12));
//        panel_52.add(btn_zdhj_volcal_slope);
//        
//        tf_zdhj_volcal_reset = new JButton("\u91CD\u7F6E");
//        tf_zdhj_volcal_reset.setFont(new Font("ËÎÌå", Font.PLAIN, 12));
//        panel_52.add(tf_zdhj_volcal_reset);
//        
//        panel_53 = new JPanel();
//        panel_53.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "\u7535\u6D41\u6821\u51C6(\u504F\u79FB\u91CF / \u659C\u7387)", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
//        panel_48.add(panel_53);
//        panel_53.setLayout(new GridLayout(0, 5, 4, 0));
//        
//        tf_zdhj_currcal_offset = new JTextField();
//        panel_53.add(tf_zdhj_currcal_offset);
//        tf_zdhj_currcal_offset.setColumns(10);
//        
//        tf_zdhj_currcal_slope = new JTextField();
//        panel_53.add(tf_zdhj_currcal_slope);
//        tf_zdhj_currcal_slope.setColumns(10);
//        
//        btn_zdhj_currcal_offset = new JButton("\u504F\u79FB");
//        btn_zdhj_currcal_offset.setFont(new Font("ËÎÌå", Font.PLAIN, 12));
//        panel_53.add(btn_zdhj_currcal_offset);
//        
//        btn_zdhj_currcal_slope = new JButton("\u659C\u7387");
//        btn_zdhj_currcal_slope.setFont(new Font("ËÎÌå", Font.PLAIN, 12));
//        panel_53.add(btn_zdhj_currcal_slope);
//        
//        btn_zdhj_currcal_reset = new JButton("\u91CD\u7F6E");
//        btn_zdhj_currcal_reset.setFont(new Font("ËÎÌå", Font.PLAIN, 12));
//        panel_53.add(btn_zdhj_currcal_reset);
//        /**************************************************************************/
//        /**************************************************************************/
//        panel_ZDHJ_AutoSaveData = new JPanel();
//        tab_panel_zdhj.add("04 Input Reg(3x)", panel_ZDHJ_AutoSaveData);
//        panel_ZDHJ_AutoSaveData.setLayout(new BorderLayout(0, 0));
//        
//        panel_59 = new JPanel();
//        panel_ZDHJ_AutoSaveData.add(panel_59, BorderLayout.NORTH);
//        panel_59.setLayout(new BoxLayout(panel_59, BoxLayout.X_AXIS));
//        
//        btn_zdhj_start_record = new JButton("\u8BFB\u53D6\u4EFB\u52A1");
//        btn_zdhj_start_record.setEnabled(false);
//        btn_zdhj_start_record.addActionListener(new ActionListener() {
//            public void actionPerformed(ActionEvent arg0) {
//                SerialComm_FBS9100.setCommCmd(FBS9100_ComBase.CMD_GetDeviceTaskInf, ByteBuffer.allocate(0));
//            }
//        });
//        panel_59.add(btn_zdhj_start_record);
//        
//        btn_zdhj_stop_record = new JButton("\u5347\u7EA7");
//        btn_zdhj_stop_record.setEnabled(false);
//        btn_zdhj_stop_record.addActionListener(new ActionListener() {
//            public void actionPerformed(ActionEvent arg0) {
//                SerialComm_FBS9100.setCommCmd(FBS9100_ComBase.CMD_SystemUpdate, ByteBuffer.allocate(0));
//            }
//        });
//        
//        btn_zdhj_new_savefile = new JButton("\u53D1\u9001\u6587\u4EF6");
//        btn_zdhj_new_savefile.setEnabled(false);
//        btn_zdhj_new_savefile.addActionListener(new ActionListener() {
//            public void actionPerformed(ActionEvent arg0) {
//                parseDir.setFileSelectionMode(JFileChooser.FILES_ONLY);
//                 parseDir.setFileFilter(new FileFilter() {
//                     @Override
//                     public boolean accept(File f) {
//                         if (f.isDirectory())
//                             return true;
//                         
//                         return (f.getName().toUpperCase().endsWith(".UC3"));  
//                     }
//                     
//                     @Override
//                     public String getDescription() {
//                         return "*.uc3";
//                     }
//                 });
//                 parseDir.setDialogTitle("´ò¿ªÉý¼¶Îļþ!");
//                 if(JFileChooser.APPROVE_OPTION == parseDir.showOpenDialog(null)) {
//                     tf_zdhj_dfu_filename.setText(parseDir.getSelectedFile().getAbsolutePath());
//                     SerialComm_FBS9100.setCommCmd_DFU(true, tf_zdhj_dfu_filename.getText(), tf_zdhj_record_state);
//                     /*
//                     String file_n = parseDir.getSelectedFile().getAbsolutePath();
//                     File f = new File(file_n);
//                    if(f.length() < (1024*11+500)) {
//                        tf_zdhj_dfu_filename.setText(parseDir.getSelectedFile().getAbsolutePath());
//                    } else {
//                        JOptionPane.showMessageDialog(frmSerialport, "Îļþ³¤¶È³¬¹ýоƬ´æ´¢¿Õ¼ä, ÇëÑ¡ÔñÕýÈ·µÄÎļþ!");
//                    }*/
//                 }
//            }
//        });
//        panel_59.add(btn_zdhj_new_savefile);
//        panel_59.add(btn_zdhj_stop_record);
//        
//        tf_zdhj_dfu_filename = new JTextField();
//        tf_zdhj_dfu_filename.setEditable(false);
//        panel_59.add(tf_zdhj_dfu_filename);
//        tf_zdhj_dfu_filename.setColumns(10);
//        
//        panel_60 = new JPanel();
//        panel_ZDHJ_AutoSaveData.add(panel_60, BorderLayout.CENTER);
//        panel_60.setLayout(new BorderLayout(0, 0));
//        
//        panel_61 = new JPanel();
//        panel_60.add(panel_61, BorderLayout.NORTH);
//        panel_61.setLayout(new BorderLayout(0, 0));
//        
//        tf_zdhj_record_state = new JTextField();
//        tf_zdhj_record_state.setEditable(false);
//        panel_61.add(tf_zdhj_record_state);
//        tf_zdhj_record_state.setColumns(10);
//        
//        scrollPane = new JScrollPane();
//        panel_60.add(scrollPane, BorderLayout.CENTER);
//        
//        ta_task_list = new JTextArea();
//        scrollPane.setViewportView(ta_task_list);
        /**************************************************************************/
        
        mMainFormTimer = new Timer(200, new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent arg0) {
                updateData();
            }
        });
    }
    
    public static void setCommData(ByteBuffer bf) {
        DataBuffer.position(0);
        DataBuffer.put(bf.array());
    }
    
    private void updateData() {
        try{
            if(null != SerialComm_FBS9100) {                
                tf_txcnt.setText(String.format("TX:%d", SerialComm_FBS9100.comm_tx_cnt));
                tf_rxcnt.setText(String.format("RX:%d", SerialComm_FBS9100.comm_rx_cnt));
                tf_dev_version.setText(String.format("V%1.1f", SerialComm_FBS9100.dev_stat_version));
                tf_dev_moncount.setText(String.format("%d", SerialComm_FBS9100.m_FBS_VCData.battSum));
                
                String group_onlinevol_text = "";
                String group_vol_text = "";
                String group_curr_text = "";
                String batt_state_text = "";
                String dev_temp_text = "";
                for(int n=0; n<FBS9100_ComBase.BattGroupCountMax; n++) {
                    group_onlinevol_text += String.format("%1.1f; ", SerialComm_FBS9100.m_FBS_VCData.onlinevol[n]);
                    group_vol_text += String.format("%1.1f; ", SerialComm_FBS9100.m_FBS_VCData.groupvol[n]);
                    group_curr_text += String.format("%1.1f; ", SerialComm_FBS9100.m_FBS_VCData.battcurr[n]);
                    batt_state_text += String.format("%d; ", SerialComm_FBS9100.m_FBS_VCData.battstate[n]);
                    dev_temp_text += String.format("%1.1f; ", SerialComm_FBS9100.m_FBS_VCData.batttemp[n]);
                }
                tf_group_vol.setText(group_vol_text);
                tf_online_vol.setText(group_onlinevol_text);
                tf_group_curr.setText(group_curr_text);
                tf_batt_state.setText(batt_state_text);
                tf_dev_temp.setText(dev_temp_text);
                tf_dev_datetime.setText(SerialComm_FBS9100.m_FBS_VCData.m_SysState.DTime.getDateTimeStr());
                
                if(SPCommFBS9100.DEV_PARAM_DATA_STATE_UPDATE == SerialComm_FBS9100.dev_param_data_state) {
                    SerialComm_FBS9100.dev_param_data_state = SPCommFBS9100.DEV_PARAM_DATA_STATE_NULL;
                    
                    tf_zdhj_devaddr.setText(String.format("%d", SerialComm_FBS9100.dev_param_addr));
                    tf_zdhj_curr_range.setText(String.format("%d", SerialComm_FBS9100.dev_param_curr_range));
                    tf_zdhj_autores_interval.setText(String.format("%d", SerialComm_FBS9100.dev_param_auto_restest_interval));
                    tf_zdhj_wenbo_curr_lev.setText(String.format("%1.2f", SerialComm_FBS9100.dev_param_wenbo_curr_lev));
                    cb_zdhj_res_testtype.setSelectedIndex(SerialComm_FBS9100.dev_param_res_test_type);
                    
                    tf_zdhj_ch1_cnt.setText(String.format("%d", SerialComm_FBS9100.m_FBS_VCData.battSum));
                    /*
                    tf_zdhj_ch2_cnt.setText(String.format("%d", SerialComm_FBS9100.dev_param_ch_mon_cnt[1]));
                    tf_zdhj_ch3_cnt.setText(String.format("%d", SerialComm_FBS9100.dev_param_ch_mon_cnt[2]));
                    tf_zdhj_ch4_cnt.setText(String.format("%d", SerialComm_FBS9100.dev_param_ch_mon_cnt[3]));
                    tf_zdhj_ch5_cnt.setText(String.format("%d", SerialComm_FBS9100.dev_param_ch_mon_cnt[4]));
                    */
                }
                
                String inf_t = "";
                if(Math.abs(new Date().getTime() - SerialComm_FBS9100.dt_cmd_ack_time.getTime()) < (1000*5)) {
                    inf_t = SPCommFBS9100.ZDHJ_OP_REST_INF_TEXT[SerialComm_FBS9100.dt_cmd_ack]
                            + " @ " + Com.get_DTF(SerialComm_FBS9100.dt_cmd_ack_time, Com.DTF_YMDhms);
                }
                tf_op_rest_inf.setText(inf_t);
                tf_param_set_inf.setText(inf_t);
                
                int mon_cnt = SerialComm_FBS9100.m_FBS_VCData.battSum;
                if(dataRow.size() != mon_cnt)
                {
                    dataRow.clear();
                    for(int n=0; n<mon_cnt; n++) {
                        Vector<String> row = new Vector<String>();
                        row.addElement(String.format("%03d", n+1));
                        row.addElement(String.format("%1.3f", SerialComm_FBS9100.m_FBS_VCData.vol[n]));
                        row.addElement(String.format("%1.3f", SerialComm_FBS9100.m_FBS_ResCapData.m_DATA[n]));
                        row.addElement(String.format("%1.1f", 0.0));
                        dataRow.add(row);
                    }
                } else {
                    for(int n=0; n<mon_cnt; n++) {
                        dataRow.get(n).setElementAt(String.format("%1.3f", SerialComm_FBS9100.m_FBS_VCData.vol[n]), 1);
                        dataRow.get(n).setElementAt(String.format("%1.3f", SerialComm_FBS9100.m_FBS_ResCapData.m_DATA[n]), 2);
                        dataRow.get(n).setElementAt(String.format("%1.1f", 0.0), 3);
                    }
                }
                table_zdhj_data.updateUI();
                
                m_TBarMonVolChart.updateChartData(TBarChart.Bar_Type_MonVol, SerialComm_FBS9100.m_FBS_VCData.vol, mon_cnt);
                m_TBarMonResChart.updateChartData(TBarChart.Bar_Type_MonRes, SerialComm_FBS9100.m_FBS_ResCapData.m_DATA, mon_cnt);
                //m_TBarMonTmpChart.updateChartData(TBarChart.Bar_Type_MonTmp, SerialComm_ZDHJ.monTmp, mon_cnt);
                //if(tab_panel_zdhj)
                if(SerialComm_FBS9100.m_TaskList.limit() > 10) {
                    SerialComm_FBS9100.m_TaskList.position(0);
                    byte[] str_b = new byte[SerialComm_FBS9100.m_TaskList.limit()];
                    /*for(int n=0; n<str_b.length; n++) {
                        str_b[n] = 0x00;
                    }*/
                    for(int n=0; n<str_b.length; n++) {
                        byte tmp = SerialComm_FBS9100.m_TaskList.get();
                        if(tmp > 0) {
                            str_b[n] = tmp;
                        } else {
                            break;
                        }
                    }
                    ta_task_list.setText(new String(str_b, "GB2312"));
                }
            }
        } catch (Exception e) {
            JOptionPane.showMessageDialog(null, "updateData():" + e.getMessage());
        }
    }
}