whyclj
2019-06-24 7db82bcad74395c674a373b4d178d122eed3006b
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
package main;
import java.util.Date;
 
import com.battmonitor.base.AppParam;
import com.battmonitor.base.Com;
import com.battmonitor.sql.MysqlConnPool;
import com.battmonitor.sql.Sql_Mysql;
import com.config.AppConfig;
import com.dev.btse.data.TmpSensor_ServerSocketThread;
import com.dev.btse.data.TmpSensor_TestDataThread;
 
public class main_MonitorServer_TmpSensor {
    /**************************************************************************/
    /**************************************************************************/
    /**************************************************************************/
    /*********************  Ï·½É豸ֻÄÜÑ¡ÔñÒ»¸ö    *******************************/
    public final static boolean is_app_for_cmcc_only = false;
    public final static boolean is_app_for_fbo_data_only = false;
    public final static boolean is_app_for_fbs_free_only = false;
    public final static boolean is_app_for_bpm7100_only = false;
    public final static boolean is_app_for_FBS9100S_only = true;
    /**************************************************************************/
    /**************************************************************************/
    /**************************************************************************/
    /**************************************************************************/
    public final static boolean app_debug = false;
    public final static double m_VersionNum = 1.001;
    public final static String m_Version = "Welcome To Use BattMonitor_TmpSensor V" 
                                            + m_VersionNum + " RC_20190112";
    /**************************************************************************/
    /**************************************************************************/
    public static final int DEF_MysqlServerFBS9100S_Port = 3360;
    public static int MysqlServer_Port = DEF_MysqlServerFBS9100S_Port;
    
    private static AppConfig m_AppConfig;
    
    private static MysqlConnPool GB_MysqlConnPool;
    private static AppParam GB_App_Param;
    /*********************************************************************************************/
    /*********************************************************************************************/
    public static void main(String[] args) {
        String ver = m_Version;
        MysqlServer_Port = DEF_MysqlServerFBS9100S_Port;
        
        System.out.println("/****************************************************************");
        System.out.println("*****************************************************************");
        System.out.println("****************************************************************/");
        System.out.println(ver);
        System.out.println("Server Started At DateTime: " + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms));
        //´´½¨config.xmlÎļþ
        m_AppConfig = new AppConfig();
        
        System.out.println("ÕýÔÚÁ¬½ÓÊý¾Ý¿â DBserver IP£º" + m_AppConfig.getMysqlServerIp() + ", port: " + MysqlServer_Port);
        
        //³õʼ»¯Á¬½Ó³ØÖеĸ÷ÖÖ²ÎÊýÐÅÏ¢
        GB_MysqlConnPool = new MysqlConnPool(m_AppConfig.getMysqlServerIp(), MysqlServer_Port, 
                                                m_AppConfig.getMysqlConnCountMax());
        
        Sql_Mysql sql_ck = new Sql_Mysql(GB_MysqlConnPool.getConn());
        try {
            if(null != sql_ck.mysql_con) {
                System.out.println("³É¹¦Á¬½ÓÊý¾Ý¿â" 
                                    + " DBserver IP£º" + m_AppConfig.getMysqlServerIp() 
                                    + ", port: " + MysqlServer_Port 
                                    + " @ " + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms));
            }
        } finally {
            sql_ck.close_con();
        }
        //´´½¨tb_app_param±í,²¢ÇÒÉèÖñíÖеÄÊý¾Ý
        GB_App_Param = new AppParam(GB_MysqlConnPool);
        
        
        
        System.out.println( "------------------- AppConfig start -----------------------------------\n"
                            + "MysqlServerIp=" + m_AppConfig.getMysqlServerIp() + "\n"
                            + "SybaseServerIp=" + m_AppConfig.getSourceSQLServerIp() + "\n"
                            + "MysqlConnCountMax=" + m_AppConfig.getMysqlConnCountMax() + "\n"
                            + "WorkThreadCountMax=" + m_AppConfig.getWorkThreadCountMax() + "\n"
                            + "SourceBattDataType=" + m_AppConfig.getSourceBattDataType() + "\n"
                            + "FbsDeviceBaseIp=" + m_AppConfig.getFbsDeviceBaseIp() + "\n"
                            + "BattAlarmFnEn=" + m_AppConfig.getBattAlarmFnEn() + "\n"
                            + "BattAlarmFnStartDelay=" + m_AppConfig.getBattAlarmFnStartDelay() + "\n"
                            + "BattAlarmClearedDelay=" + m_AppConfig.getBattAlarmClearedDelay() + "\n"
                            + "BattResStoreFnEn=" + m_AppConfig.getBattResStoreFnEn() + "\n"
                            + "BattResStoreDelayForTestManual=" + m_AppConfig.getBattResStoreDelayForTestManual() + "\n"
                            + "BattResStoreDayInterval=" + m_AppConfig.getBattResStoreDayInterval() + "\n"
                            + "------------------- AppConfig end -----------------------------------\n");
                            
        System.out.println( "--------------------- App_Param start---------------------------------\n"
                            + "Discharge_TestTimeLongMinimum=" 
                            + GB_App_Param.getTestTimeLongMinimum(AppParam.AppParam_Discharge) + "\n"
                            + "Discharge_SaveDataTimeInterval=" 
                            + GB_App_Param.getSaveDataTimeInterval(AppParam.AppParam_Discharge) + "\n"
                            + "Discharge_MonVolChangeLevel=" 
                            + GB_App_Param.getMonVolChangeLevel(AppParam.AppParam_Discharge) + "\n"
                            + "Discharge_BattTestGroupCountMax=" 
                            + GB_App_Param.getBattTestGroupCountMax(AppParam.AppParam_Discharge) + "\n"
                            + "Discharge_TestDataRecordCountMax=" 
                            + GB_App_Param.getTestDataRecordCountMax(AppParam.AppParam_Discharge) + "\n"
                            + "--------------------------------------------------------------------\n"
                            + "Charge_TestTimeLongMinimum=" 
                            + GB_App_Param.getTestTimeLongMinimum(AppParam.AppParam_Charge) + "\n"
                            + "Charge_SaveDataTimeInterval=" 
                            + GB_App_Param.getSaveDataTimeInterval(AppParam.AppParam_Charge) + "\n"
                            + "Charge_MonVolChangeLevel=" 
                            + GB_App_Param.getMonVolChangeLevel(AppParam.AppParam_Charge) + "\n"
                            + "Charge_BattTestGroupCountMax=" 
                            + GB_App_Param.getBattTestGroupCountMax(AppParam.AppParam_Charge) + "\n"
                            + "Charge_TestDataRecordCountMax=" 
                            + GB_App_Param.getTestDataRecordCountMax(AppParam.AppParam_Charge) + "\n"
                            + "--------------------------------------------------------------------\n"
                            + "Poweroff_TestTimeLongMinimum=" 
                            + GB_App_Param.getTestTimeLongMinimum(AppParam.AppParam_PowerOff) + "\n"
                            + "Poweroff_SaveDataTimeInterval=" 
                            + GB_App_Param.getSaveDataTimeInterval(AppParam.AppParam_PowerOff) + "\n"
                            + "Poweroff_MonVolChangeLevel=" 
                            + GB_App_Param.getMonVolChangeLevel(AppParam.AppParam_PowerOff) + "\n"
                            + "Poweroff_BattTestGroupCountMax=" 
                            + GB_App_Param.getBattTestGroupCountMax(AppParam.AppParam_PowerOff) + "\n"
                            + "Poweroff_TestDataRecordCountMax=" 
                            + GB_App_Param.getTestDataRecordCountMax(AppParam.AppParam_PowerOff) + "\n"
                            + "--------------------------------------------------------------------\n"
                            + "Discharge_BattJunHengFN=" + GB_App_Param.getBattJunHengFN() + "\n" 
                            + "--------------------- App_Param end---------------------------------\n");
        /*********************************************************************************/
        /*********************************************************************************/
        /*********************************************************************************/
        /*********************************************************************************/
        
        {
            TmpSensor_ServerSocketThread serverThread = new TmpSensor_ServerSocketThread(GB_MysqlConnPool);
            serverThread.start();
        }
        
        
        {
            TmpSensor_TestDataThread saveThread = new TmpSensor_TestDataThread(GB_MysqlConnPool);
            saveThread.start();
        }
        
    }
}