FBS9600通信程序,带了均衡电压版本
Administrator
2021-08-12 8467d3be4ce3be340d36f45c83d370def9e7e50f
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
package com.dev.fbs9600s;
 
import java.util.ArrayList;
import java.util.Date;
 
import com.base.Com;
import com.battdata_rt.BattData_RT_Array;
import com.sql.MysqlConnPool;
 
public class FBS9600S_ServerSocket_Thread extends Thread{
    private MysqlConnPool pool;
    private BattData_RT_Array data;
    private ArrayList<FBS9600S_SystemState> AL_State = new ArrayList<FBS9600S_SystemState>();
    private ArrayList<Integer> AL_FBSDeviceId = new ArrayList<Integer>();
    private ArrayList<FBS9600S_SocketClient_Thread> AL_FBSSocketClient = new ArrayList<FBS9600S_SocketClient_Thread>();
 
    
    
    public FBS9600S_ServerSocket_Thread(MysqlConnPool pool, BattData_RT_Array m_Data) {
        this.pool = pool;
        this.data = m_Data;
        
        for(int n=0; n<m_Data.getItemCount(); n++)
        {
            if((9600 != (m_Data.getItem(n).FBSDeviceId/100000)) && (9611 != (m_Data.getItem(n).FBSDeviceId/100000)))
            {
                continue;
            }            
            if(false == AL_FBSDeviceId.contains(m_Data.getItem(n).FBSDeviceId))
            {
                
                AL_FBSDeviceId.add(m_Data.getItem(n).FBSDeviceId);
                AL_State.add(new FBS9600S_SystemState(m_Data.getItem(n).FBSDeviceIp, m_Data.getItem(n).FBSDeviceId));
            }
        }
    }
    
    @Override
    public void run() {
        System.out.println(this.getName() + " - FBS9600S_ServerSocket_Thread Started at "+Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms));
        
        for(int n=0; n<AL_FBSDeviceId.size(); n++ )
        {
            FBS9600S_SocketClient_Thread client = new FBS9600S_SocketClient_Thread(AL_State.get(n),pool, data);
            AL_FBSSocketClient.add(client);
            client.start();
            System.out.println("FBS9600S_DEV" + (n+1) 
                                + " Id: " + AL_State.get(n).dev_id 
                                + ", Ip: " + AL_State.get(n).dev_ip);
        }
        while(true) {
            
        }
        
    }
}