|
@@ -22,6 +22,7 @@
|
|
#include "ya_setting.h"
|
|
#include "ya_setting.h"
|
|
#include "websocket/web_connect.h"
|
|
#include "websocket/web_connect.h"
|
|
#include "forbid_staff_down_mine.h"
|
|
#include "forbid_staff_down_mine.h"
|
|
|
|
+#include "min_system.h"
|
|
|
|
|
|
config_file config;
|
|
config_file config;
|
|
void handlereader(uint32_t readerid,bool duration,uint32_t t)
|
|
void handlereader(uint32_t readerid,bool duration,uint32_t t)
|
|
@@ -42,34 +43,42 @@ void Handle_ThreeRates_Event_Callback(const int evType, const int evId, uint64_t
|
|
|
|
|
|
struct Init_Setting
|
|
struct Init_Setting
|
|
{
|
|
{
|
|
- void init()
|
|
|
|
- {
|
|
|
|
- YADB::_DB_POOL_SETTING_ DBSetting;
|
|
|
|
- DBSetting.Host = config.get("db.host","127.0.0.1");
|
|
|
|
- DBSetting.User = config.get("db.user","root");
|
|
|
|
- DBSetting.PWD = config.get("db.passwd","123456");
|
|
|
|
- DBSetting.DBName = config.get("db.dbname","yaxt");
|
|
|
|
- DBSetting.CharSet = config.get("db.charset","utf8");
|
|
|
|
- DBSetting.TimeOut = config.get("db.conn_timeout",5);
|
|
|
|
- DBSetting.PoolSize = config.get("db.pool_size",30);
|
|
|
|
- DBSetting.Port = config.get("db.port",3306);
|
|
|
|
- if(!_mysql_init(DBSetting))
|
|
|
|
|
|
+ void init() {
|
|
|
|
+ //是否最小系统
|
|
|
|
+ CYaSetting::g_minSystem = config.get("minsystem", 0);
|
|
|
|
+ if (CYaSetting::g_minSystem)
|
|
{
|
|
{
|
|
- std_info("连接DB[%s:%s] 失败,采集服务器无法启动!",DBSetting.Host.c_str(),DBSetting.User.c_str());
|
|
|
|
|
|
+ s_min_system.initSystem(&config);
|
|
|
|
+ }
|
|
|
|
+ YADB::_DB_POOL_SETTING_ DBSetting;
|
|
|
|
+ DBSetting.Host = config.get("db.host", "127.0.0.1");
|
|
|
|
+ DBSetting.User = config.get("db.user", "root");
|
|
|
|
+ DBSetting.PWD = config.get("db.passwd", "123456");
|
|
|
|
+ DBSetting.DBName = config.get("db.dbname", "yaxt");
|
|
|
|
+ DBSetting.CharSet = config.get("db.charset", "utf8");
|
|
|
|
+ DBSetting.TimeOut = config.get("db.conn_timeout", 5);
|
|
|
|
+ DBSetting.PoolSize = config.get("db.pool_size", 30);
|
|
|
|
+ DBSetting.Port = config.get("db.port", 3306);
|
|
|
|
+ if (!_mysql_init(DBSetting)) {
|
|
|
|
+ std_info("连接DB[%s:%s] 失败,采集服务器无法启动!", DBSetting.Host.c_str(), DBSetting.User.c_str());
|
|
exit(0);
|
|
exit(0);
|
|
}
|
|
}
|
|
-
|
|
|
|
- std::string url=config.get("service.websocket_url","ws://127.0.0.1:8086");
|
|
|
|
- int32_t send_interval =config.get("service.interval_send_json_postion",1);
|
|
|
|
- std_info("json_interval:%d",send_interval);
|
|
|
|
- std::vector<std::string> url_list;
|
|
|
|
- url_list.push_back(url);
|
|
|
|
- if(!wsClientMgr_init(url_list,send_interval))
|
|
|
|
|
|
+ if (!CYaSetting::g_minSystem)
|
|
{
|
|
{
|
|
- std_info("连接webServer[%s] 失败,采集服务器无法启动!",url.c_str());
|
|
|
|
- exit(0);
|
|
|
|
|
|
+ std::string url = config.get("service.websocket_url", "ws://127.0.0.1:8086");
|
|
|
|
+ int32_t send_interval = config.get("service.interval_send_json_postion", 1);
|
|
|
|
+ std_info("json_interval:%d", send_interval);
|
|
|
|
+ std::vector<std::string> url_list;
|
|
|
|
+ url_list.push_back(url);
|
|
|
|
+ if (!wsClientMgr_init(url_list, send_interval))
|
|
|
|
+ {
|
|
|
|
+ std_info("连接webServer[%s] 失败,采集服务器无法启动!", url.c_str());
|
|
|
|
+ exit(0);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //三率模块
|
|
|
|
+ init_three_rates(DBSetting);
|
|
}
|
|
}
|
|
-
|
|
|
|
if(0)
|
|
if(0)
|
|
{
|
|
{
|
|
std::vector<char> b(1024*1024);
|
|
std::vector<char> b(1024*1024);
|
|
@@ -93,28 +102,24 @@ struct Init_Setting
|
|
mine_business::inst()->load();
|
|
mine_business::inst()->load();
|
|
event_list::instance()->load_his_data_from_db();
|
|
event_list::instance()->load_his_data_from_db();
|
|
card_list::instance()->load_his_card_postion_from_db();
|
|
card_list::instance()->load_his_card_postion_from_db();
|
|
- db_para dp;
|
|
|
|
- dp.Host=DBSetting.Host;
|
|
|
|
- dp.User=DBSetting.User;
|
|
|
|
- dp.PWD=DBSetting.PWD ;
|
|
|
|
- dp.DBName=DBSetting.DBName;
|
|
|
|
- dp.CharSet=DBSetting.CharSet ;
|
|
|
|
- dp.TimeOut=DBSetting.TimeOut;
|
|
|
|
- dp.PoolSize=DBSetting.PoolSize;
|
|
|
|
- init_three_rates(dp);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
log_info("Init_Setting::init Success. \n" );
|
|
log_info("Init_Setting::init Success. \n" );
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- void init_three_rates(const db_para& dbs)
|
|
|
|
|
|
+ void init_three_rates(const YADB::_DB_POOL_SETTING_ & dbset)
|
|
{
|
|
{
|
|
- log_info("init three_rates ...................");
|
|
|
|
|
|
+ db_para dps;
|
|
|
|
+ dps.Host = dbset.Host;
|
|
|
|
+ dps.User = dbset.User;
|
|
|
|
+ dps.PWD = dbset.PWD;
|
|
|
|
+ dps.DBName = dbset.DBName;
|
|
|
|
+ dps.CharSet = dbset.CharSet;
|
|
|
|
+ dps.TimeOut = dbset.TimeOut;
|
|
|
|
+ dps.PoolSize = dbset.PoolSize;
|
|
|
|
+
|
|
init_para ip;
|
|
init_para ip;
|
|
ip.send_pt = handlereader;
|
|
ip.send_pt = handlereader;
|
|
ip.driving_face_alarm = Handle_ThreeRates_Event_Callback;
|
|
ip.driving_face_alarm = Handle_ThreeRates_Event_Callback;
|
|
- three_rates::get_instance()->init(ip,dbs);
|
|
|
|
|
|
+ three_rates::get_instance()->init(ip,dps);
|
|
three_rates::get_instance()->start();
|
|
three_rates::get_instance()->start();
|
|
std_info("加载三率模块成功");
|
|
std_info("加载三率模块成功");
|
|
}
|
|
}
|