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
package com.dev.ntm;
import gnu.io.SerialPort;
import gnu.io.UnsupportedCommOperationException;
 
import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.ArrayList;
import java.util.Date;
 
import javax.swing.JOptionPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
 
import org.apache.logging.log4j.Logger;
 
import sp_comm.CommSerialPort;
import sp_comm.SP_COMM;
import main.page_debug_inf;
 
import com.Com;
import com.PlaySound;
import com.dev.fbs9600_mon.SPCommMon;
import com.dev.fbs9600_mon.SPCommMon_DFU;
import com.dev.ntm.cmd.NTM_Cmd;
import com.dev.ntm.cmd.NTM_ComBuf;
import com.dev.ntm.cmd.NTM_MonData;
import com.dev.ntm.cmd.NTM_TestData;
import com.dev.ntm.cmd.NTM_TestParam;
 
public class SPCommNTM implements Runnable {
 
    public  boolean CommThreadRunning = false;
    private ByteBuffer CommRxBuffer = ByteBuffer.allocate(15000); 
    private ByteBuffer CommTxBuffer = ByteBuffer.allocate(1048);
    
    public int comm_tx_cnt = 0;
    public int comm_rx_cnt = 0;
    
    private int comm_bautrate = 9600;
    public int dt_target_addr = 0;
    //--------------------------------------------------------//
    
    //--------------------------------------------------------//
    public int dev_version = 0;
    public String dev_type = "";
    //--------------------------------------------------------//
    private short dt_cmd = NTM_Cmd.CMD_LogIn;
    private short dt_usr_cmd = NTM_Cmd.CMD_NULL;
    public short dt_cmd_ack = 0;
    public Date dt_cmd_ack_time = new Date();
    private int dt_cmd_cnt = 0;
    
    private boolean mLoginStat = false;
    private ByteBuffer dt_datatoCMD = ByteBuffer.allocate(0);
    private ByteBuffer dt_datatoINF = ByteBuffer.allocate(0);
    public NTM_Cmd m_NTM_Cmd = new NTM_Cmd();
    public NTM_TestData m_TestData = new NTM_TestData();
    public NTM_TestParam m_TestParam = new NTM_TestParam();
    public NTM_MonData m_MonData = new NTM_MonData();
    public String mDevInf = "";
    public String mCurrentBattGroupName = "";
    public int mBattGroupNameCnt = 0;
    public int mReadBattGroupNameindex = 0;
    public int mSetBattGroupNameindex = 0;
    
    public String m_SelectedFilePathName = "";            //Êý¾Ý¹ÜÀíÒ³ÃæÑ¡ÔñÊý¾ÝÎļþÃû³Æ,¸ñʽΪ£ºµç³Ø×éÃû/Êý¾ÝÎļþÃû
    public ArrayList<String> mBattGroupNames = new ArrayList<String>();
    
    public int mTestFileCnt = 0;
    public int mReadTestFileindex = 0;
    public int mSetTestFileindex = 0;
    public ArrayList<String> mTestFiles = new ArrayList<String>();
    private boolean mReadFileStat = false;
    private int mReadFileTimeOut = 0;
    
    public int mDatablockCnt = 0;
    public int mDatablockIndex = 0;
    
    private page_debug_inf dt_debug_inf;
    private int m_COMM_PORT_TYPE = 0;
    //private CommSerialPort m_SP_Comm = null;
    //private Comm_Socket m_SocketComm = null;
    private SP_COMM m_SP_COMM = null;
    SPCommMon_DFU m_SPCommDFU = null;
    public JTextField tf_opres_inf = null;
    
    public boolean dt_update_en = false;
    private String dt_update_file = "";
    public JTextArea dt_show_dfu_inf = null;
    public byte[] dt_task_inf = new byte[1524];
    private Logger m_Log = null;
    
    public SPCommNTM(int comm_type, int addr_t, int bitrate, 
                    JTextArea show_dfu_inf, page_debug_inf debug, Logger log) {
        m_Log = log;
        m_SP_COMM = new SP_COMM(comm_type, 12245, m_Log);
        
        dt_target_addr = addr_t & 0x00FF;
        comm_bautrate = bitrate;
        dt_show_dfu_inf = show_dfu_inf;
        dt_debug_inf = debug;
    }
    
    public void setCommBautrate(int bt_rate) {
        if(SP_COMM.COMM_TYPE_Serial != m_SP_COMM.m_CommType) {
            return;
        }
        
        try {
            comm_bautrate = bt_rate;
            m_SP_COMM.m_SP_Comm.serialPort.setSerialPortParams(comm_bautrate, SerialPort.DATABITS_8, SerialPort.STOPBITS_1,SerialPort.PARITY_NONE);
        } catch (UnsupportedCommOperationException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
    
    //³õʼ»¯´®¿Ú
    public boolean OpenCommPort(String comm_name_or_ip, int bitrate_or_comm_port) {
        boolean res = m_SP_COMM.openCommPort(comm_name_or_ip, bitrate_or_comm_port);
        if(true == res) {
            CommTxBuffer.order(ByteOrder.LITTLE_ENDIAN);
            CommRxBuffer.order(ByteOrder.LITTLE_ENDIAN);
            
            comm_tx_cnt = 0;
            comm_rx_cnt = 0;
            CommThreadRunning = true;
        }
        
        return res;
    }
    
    private ByteBuffer makeCommTxData() {
        
        ByteBuffer cmd_buf = ByteBuffer.allocate(0);
        ByteBuffer inf_buf = ByteBuffer.allocate(0);
        if(/*(false == mReadFileStat) &&*/ (NTM_Cmd.CMD_NULL == dt_usr_cmd)) {
            if(false == mLoginStat) {
                dt_cmd = NTM_Cmd.CMD_LogIn;
            } else {
                if("" == mDevInf) {
                    dt_cmd = NTM_Cmd.CMD_GetVersion;
                } else {
                    if(++dt_cmd_cnt  > 1000) {
                        dt_cmd_cnt = 0;
                    }
                    dt_cmd = NTM_Cmd.CMD_GetDischargeData;
                    if(0 == dt_cmd_cnt%3) {
                        dt_cmd = NTM_Cmd.CMD_GetMonData;
                    }
                    if(0 == dt_cmd_cnt%5) {
                        dt_cmd = NTM_Cmd.CMD_HeartBeat;        //get current battgroup name
                    }
                }
            }
        } else {
            dt_cmd = dt_usr_cmd;
            cmd_buf = dt_datatoCMD;
            inf_buf = dt_datatoINF;
            dt_usr_cmd = NTM_Cmd.CMD_NULL;
        }
        
        ByteBuffer buf_t = NTM_ComBuf.makeNTMCommBuf(dt_target_addr, dt_cmd, cmd_buf, inf_buf, false);
        
        return buf_t;
    }
    
    public boolean tr_Msg(ByteBuffer bbf_tx, ByteBuffer bbf_rx, boolean showdat) {
        if(++comm_tx_cnt > Com.CNT_MAX) {
            comm_tx_cnt = 0;
        }
        return m_SP_COMM.tr_Msg(bbf_tx, bbf_rx, CommSerialPort.mutycomm_Type_Samd09, dt_debug_inf, showdat);
    }
    
    public void exitCommThread() {
        CommThreadRunning = false;
        if(null != m_SPCommDFU) {
            m_SPCommDFU.setDFUCommState(false, false);
        }
    }
    
    public void setCommCmd(short cmd, ByteBuffer cmd_data, ByteBuffer inf_data) {
        if(NTM_Cmd.CMD_NULL != dt_usr_cmd) {
            return;
        }
        
        if(true == mReadFileStat) {
            if(mReadFileTimeOut < 100) {
                mReadFileTimeOut += 1;
            }
            if(mReadFileTimeOut >= 10) {
                mReadFileStat = false;
            } else {
                if((NTM_Cmd.CMD_GetBattGroupNames!=cmd) && (NTM_Cmd.CMD_GetTestFileNames!=cmd)
                    && (NTM_Cmd.CMD_GetTestFile!=cmd)) {
                    return;
                }
            }
        }
        if((NTM_Cmd.CMD_GetBattGroupNames==cmd) || (NTM_Cmd.CMD_GetTestFileNames==cmd)
                ||(NTM_Cmd.CMD_GetTestFile==cmd)) {
            mReadFileStat = true;
            mReadFileTimeOut = 0;
        }
        
        dt_usr_cmd = cmd;
        dt_datatoCMD = cmd_data;
        dt_datatoINF = inf_data;
    }
    
    public void setUpdateCmd(boolean update_en, String filepath) {
        dt_update_en = update_en;
        dt_update_file = filepath;
        if(true == dt_update_en) {
            dt_usr_cmd = NTM_Cmd.CMD_StartDFU;
            dt_datatoCMD = null;
            dt_datatoINF = null;
        } else {
            if(null != m_SPCommDFU) {
                m_SPCommDFU.setDFUCommState(false, false);
            }
        }
    }
    
    private void playSound() {
        new PlaySound("6133.wav");
    }
    
    public void setCommCmdAck(short ack_t) {
        dt_cmd_ack = ack_t;
        dt_cmd_ack_time = new Date();
    }
    
    public void setSelectFilePathName(String path) {
        m_SelectedFilePathName = path;
    }
    public String getSelectFilePathName() {
        return m_SelectedFilePathName;
    }
    /*********************************************************************************************/
    public String getDataFromCommBuf(ByteBuffer bf)
      {
        String msg = "";
        if(true == m_NTM_Cmd.putByteBuffer(bf)) {
            switch(m_NTM_Cmd.CMD) {
                case NTM_Cmd.CMD_LogIn: {
                    mLoginStat = true;
                    dev_version = m_NTM_Cmd.DB1;
                    dev_type = String.valueOf(m_NTM_Cmd.DB3) + "." + String.valueOf(m_NTM_Cmd.DB2);
                    dt_debug_inf.addDebugInf(Com.get_DTF(new Date(), Com.DTF_YMDhms_S) 
                            + " Login NTM device, dev_type: " + dev_type + ", dev_version: " + dev_version + "\n");
                }
                break;
                
                case NTM_Cmd.CMD_LogOut: {
                    dt_debug_inf.addDebugInf(Com.get_DTF(new Date(), Com.DTF_YMDhms_S) 
                            + " Logout NTM device, dev_version: " + mDevInf.replaceAll("\n", ",") + "\n");
                }
                break;
                
                case NTM_Cmd.CMD_GetVersion: {
                    byte[] bt = new byte[bf.limit()];
                    bf.get(bt);
                    mDevInf = new String(bt);
                    dt_debug_inf.addDebugInf(Com.get_DTF(new Date(), Com.DTF_YMDhms_S) + " Get version: " + mDevInf + "\n");
                }
                break;
                
                case NTM_Cmd.CMD_HeartBeat: {
                    byte[] bt = new byte[bf.limit()];
                    bf.get(bt);
                    try {
                        mCurrentBattGroupName = new String(bt, "utf-8");
                    } catch (UnsupportedEncodingException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
                }
                break;
                
                case NTM_Cmd.CMD_GetBattGroupNames: {
                    byte[] bt = new byte[bf.limit()];
                    bf.get(bt);
                    mBattGroupNameCnt = m_NTM_Cmd.DB1*256 + m_NTM_Cmd.DB2;
                    mReadBattGroupNameindex = m_NTM_Cmd.DB3*256 + m_NTM_Cmd.DB4;
                    String bg_name = "";
                    try {
                        bg_name = new String(bt, "utf-8");
                    } catch (UnsupportedEncodingException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
                    if(0 == mReadBattGroupNameindex) {
                        mBattGroupNames.clear();
                    }
                    mBattGroupNames.add(bg_name);
                    
                    mReadBattGroupNameindex += 1;
                    msg = NTM_Cmd.getAckCmdText(m_NTM_Cmd.CMD) + mReadBattGroupNameindex + "/" + mBattGroupNameCnt;
                    setCommCmdAck(m_NTM_Cmd.CMD);
                    
                    if(mReadBattGroupNameindex < mBattGroupNameCnt) {
                        ByteBuffer bf_cmd = ByteBuffer.allocate(2);
                        bf_cmd.put((byte) (mReadBattGroupNameindex/256));
                        bf_cmd.put((byte) (mReadBattGroupNameindex%256));
                        bf_cmd.position(0);
                        setCommCmd(NTM_Cmd.CMD_GetBattGroupNames, bf_cmd, null);
                    } else {
                        mReadFileStat = false;
                        playSound();
                    }
                }
                break;
                
                case NTM_Cmd.CMD_GetTestFileNames: {
                    byte[] bt = new byte[bf.limit()];
                    bf.get(bt);
                    mTestFileCnt = m_NTM_Cmd.DB1*256 + m_NTM_Cmd.DB2;
                    mReadTestFileindex = m_NTM_Cmd.DB3*256 + m_NTM_Cmd.DB4;
                    String file_name = "";
                    try {
                        file_name = new String(bt, "utf-8");
                    } catch (UnsupportedEncodingException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
                    if(0 == mReadTestFileindex) {
                        mTestFiles.clear();
                    }
                    mTestFiles.add(file_name);
                    
                    mReadTestFileindex += 1;
                    msg = NTM_Cmd.getAckCmdText(m_NTM_Cmd.CMD) + mReadTestFileindex + "/" + mTestFileCnt;
                    setCommCmdAck(m_NTM_Cmd.CMD);
                    
                    if(mReadTestFileindex < mTestFileCnt) {
                        ByteBuffer bf_cmd = ByteBuffer.allocate(4);
                        bf_cmd.put((byte) (mSetBattGroupNameindex/256));
                        bf_cmd.put((byte) (mSetBattGroupNameindex%256));
                        bf_cmd.put((byte) (mReadTestFileindex/256));
                        bf_cmd.put((byte) (mReadTestFileindex%256));
                        bf_cmd.position(0);
                        setCommCmd(NTM_Cmd.CMD_GetTestFileNames, bf_cmd, null);
                    } else {
                        mReadFileStat = false;
                        playSound();
                    }
                }
                break;
                
                case NTM_Cmd.CMD_GetTestFile: {
                    byte[] bt = new byte[bf.limit()];
                    bf.get(bt);
                    mDatablockCnt = m_NTM_Cmd.DB1*256 + m_NTM_Cmd.DB2;
                    mDatablockIndex = m_NTM_Cmd.DB3*256 + m_NTM_Cmd.DB4;
                    
                    if(0 == mDatablockIndex) {
                        File file = new File("ntm.fbo");
                        if(file.exists()) {
                            file.delete();
                        }
                    }
                    
                    RandomAccessFile randomFile;
                    try {
                        randomFile = new RandomAccessFile("ntm.fbo", "rw");
                        randomFile.seek(randomFile.length());//½«Ð´ÎļþÖ¸ÕëÒÆµ½Îļþβ
                        randomFile.write(bt);
                        randomFile.close();
                    } catch (IOException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
                    
                    mDatablockIndex += 1;
                    msg = NTM_Cmd.getAckCmdText(m_NTM_Cmd.CMD) + mDatablockIndex + "/" + mDatablockCnt;
                    setCommCmdAck(m_NTM_Cmd.CMD);
                    
                    if(mDatablockIndex < mDatablockCnt) {
                        ByteBuffer bf_cmd = ByteBuffer.allocate(2);
                        bf_cmd.put((byte) (mDatablockIndex/256));
                        bf_cmd.put((byte) (mDatablockIndex%256));
                        bf_cmd.position(0);
                        
                        ByteBuffer bf_inf = null;
                        try {
                            bf_inf = ByteBuffer.wrap(m_SelectedFilePathName.getBytes("utf-8"));
                        } catch (UnsupportedEncodingException e) {
                            // TODO Auto-generated catch block
                            e.printStackTrace();
                        }
                        bf_inf.position(0);
                        
                        setCommCmd(NTM_Cmd.CMD_GetTestFile, bf_cmd, bf_inf);
                    } else {
                        mReadFileStat = false;
                        playSound();
                    }
                }
                break;
                
                case NTM_Cmd.CMD_GetDischargeData: {
                    m_TestData.putByteBuffer(bf);
                }
                break;
                
                case NTM_Cmd.CMD_GetMonData: {
                    int mon_cnt = m_NTM_Cmd.DB1*256 + m_NTM_Cmd.DB2;
                    m_MonData.putByteBuffer(bf, mon_cnt);
                }
                break;
                
                case NTM_Cmd.CMD_ChangeToParamPage: {
                    playSound();
                    msg = NTM_Cmd.getAckCmdText(m_NTM_Cmd.CMD);
                    setCommCmdAck(m_NTM_Cmd.CMD);
                    try {
                        Thread.sleep(800);
                    } catch (InterruptedException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
                    setCommCmd(NTM_Cmd.CMD_SetDisParm, null, m_TestParam.getByteBuffer());
                }
                break;
                
                case NTM_Cmd.CMD_GetDisParm: {
                    m_TestParam.putByteBuffer(bf);
                    playSound();
                    msg = NTM_Cmd.getAckCmdText(m_NTM_Cmd.CMD);
                    setCommCmdAck(m_NTM_Cmd.CMD);
                }
                break;
                
                case NTM_Cmd.CMD_SetDisParm: {
                    playSound();
                    msg = NTM_Cmd.getAckCmdText(m_NTM_Cmd.CMD);
                    setCommCmdAck(m_NTM_Cmd.CMD);
                    
                    try {
                        Thread.sleep(800);
                    } catch (InterruptedException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
                    setCommCmd(NTM_Cmd.CMD_GetDisParm, null, null);
                }
                break;
                
                case NTM_Cmd.CMD_GetTaskInf: {
                    bf.position(0);
                    for(int n=0; n<bf.limit(); n++) {
                        dt_task_inf[n] = bf.get();
                    }
                }
                break;
                
                case NTM_Cmd.CMD_StartDischarge: 
                case NTM_Cmd.CMD_PauseDischarge: 
                case NTM_Cmd.CMD_StopDischarge: 
                case NTM_Cmd.CMD_StartCharge: 
                case NTM_Cmd.CMD_PauseCharge: 
                case NTM_Cmd.CMD_StopCharge:
                case NTM_Cmd.CMD_StartCircleDC: 
                case NTM_Cmd.CMD_PauseCircleDC: 
                case NTM_Cmd.CMD_StopCircleDC: 
                case NTM_Cmd.CMD_ClearDevAlarm: {
                    playSound();
                    msg = NTM_Cmd.getAckCmdText(m_NTM_Cmd.CMD);
                    setCommCmdAck(m_NTM_Cmd.CMD);
                }
                break;
                
                default: break;
            }
            
            if(null != tf_opres_inf) {
                if(msg.length() > 0) {
                    tf_opres_inf.setText(msg);
                }
            }
            
            if(++comm_rx_cnt > 1000000) {
                comm_rx_cnt = 0;
            }
        }
        
        return msg;
    }
    
    private void closeNTMCommPort() {
        m_SP_COMM.closeCommPort();
    }
    
    public void run() {
        int run_cnt = 0;
        while(true == CommThreadRunning) {
            try {
                Thread.sleep(100);
                if(false == dt_update_en) {
                    if((NTM_Cmd.CMD_NULL != dt_usr_cmd) || (0 == (run_cnt%5))) {
                        tr_Msg(makeCommTxData(), CommRxBuffer, true);
                        getDataFromCommBuf(CommRxBuffer);
                    }
                } else {
                    try {
                        setCommCmd(NTM_Cmd.CMD_StartDFU, null, null);
                        CommTxBuffer.clear();
                        CommTxBuffer.put(makeCommTxData());
                        CommTxBuffer.flip();
                        tr_Msg(CommTxBuffer, CommRxBuffer, true);
                        Thread.sleep(100);
                    } catch (InterruptedException e2) {
                        // TODO Auto-generated catch block
                        e2.printStackTrace();
                    }
                    
                    String dfu_text_inf = "";
                    m_SPCommDFU = new SPCommMon_DFU(m_SP_COMM,
                                                    SPCommMon.DEV_TYPE_NTM,
                                                    dt_target_addr,
                                                    true,
                                                    dt_show_dfu_inf,
                                                    dt_debug_inf);
                    m_SPCommDFU.runDFU(dt_update_file, dfu_text_inf);
                    
                    dt_update_en = false;
                    setCommCmd(NTM_Cmd.CMD_NULL, null, null);
                    //-----------------------------------------------------------------------------//
                    dfu_text_inf = dt_show_dfu_inf.getText();
                    dt_show_dfu_inf.setText(dfu_text_inf + "DFU Process Stopped!\n");
                    //-----------------------------------------------------------------------------//
                    //-----------------------------------------------------------------------------//
                }
                
                run_cnt += 1;
                if(run_cnt > 999) {
                    run_cnt = 0;
                }
                
            } catch (InterruptedException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
                exitCommThread();
                JOptionPane.showMessageDialog(null, "NTM CommPort Í¨ÐÅÒì³£: " + e.getMessage());
            }
        }
        /******************************************/
        setCommCmd(NTM_Cmd.CMD_LogOut, ByteBuffer.allocate(0), ByteBuffer.allocate(0));
        tr_Msg(makeCommTxData(), CommRxBuffer, true);
        getDataFromCommBuf(CommRxBuffer);
        
        closeNTMCommPort();
        /******************************************/
        dt_debug_inf.addDebugInf(Com.get_DTF(new Date(), Com.DTF_YMDhms_S) 
                                + " NTM CommPort is quit,"
                                + " COMM_PORT_TYPE: " + m_COMM_PORT_TYPE + "\n");
        /******************************************/
    }
}