81 lines
2.6 KiB
C++
81 lines
2.6 KiB
C++
|
|
#include <common/L2Event.h>
|
|||
|
|
#include <dao/DbStandardDBAX.h>
|
|||
|
|
#include <eqpm/eqpm_icei.h>
|
|||
|
|
#include <log4cplus/LOG.h>
|
|||
|
|
#include <string>
|
|||
|
|
#include <thread>
|
|||
|
|
|
|||
|
|
eqpmICEI::eqpmICEI() {
|
|||
|
|
eqpm_alg_.init();
|
|||
|
|
this->logger_ = std::make_unique<LOG>("eqpm_icei");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
eqpmICEI::~eqpmICEI() { logger_->Info() << "eqpmICEI::~eqpmICEI()" << endl; }
|
|||
|
|
|
|||
|
|
void baosight::eqpmICEI::SendDataShort(::Ice::Int eventNo,
|
|||
|
|
const ::Ice::ByteSeq &seq,
|
|||
|
|
::Ice::Int length,
|
|||
|
|
const Ice::Current ¤t) {
|
|||
|
|
logger_->Info() << "event no:" << eventNo << endl; /* ALARM! */
|
|||
|
|
string str(seq.begin(), seq.end());
|
|||
|
|
// 根据电文号调用,执行分派任务操作
|
|||
|
|
switch (eventNo) {
|
|||
|
|
case 99999:
|
|||
|
|
logger_->Debug() << "test" << std::endl;
|
|||
|
|
eqpm_alg_.update_repair(str);
|
|||
|
|
break;
|
|||
|
|
case 1002: /*机组状态-画面数据*/
|
|||
|
|
eqp_status_.dispose(eventNo, seq, length);
|
|||
|
|
break;
|
|||
|
|
default:
|
|||
|
|
logger_->Error() << "wrong event No.!" << endl;
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void baosight::eqpmICEI::SendDataLong(
|
|||
|
|
::Ice::Int eventNo, const ::Ice::ByteSeq &seq, ::Ice::Int length,
|
|||
|
|
const ::std::string &sender, const ::std::string &receiver,
|
|||
|
|
const ::std::string &additional, const Ice::Current ¤t) {}
|
|||
|
|
|
|||
|
|
void baosight::eqpmICEI::TimeNotify(::Ice::Int eventNo,
|
|||
|
|
const ::Ice::ByteSeq &seq,
|
|||
|
|
const Ice::Current ¤t) {
|
|||
|
|
// if (eventNo == 0) {
|
|||
|
|
// eqpm_alg_.update_data();
|
|||
|
|
// } else if (eventNo == 1) {
|
|||
|
|
// eqpm_alg_.update_repair();
|
|||
|
|
// }
|
|||
|
|
// logger_->Debug() << "eqpm" << std::endl;
|
|||
|
|
// // eqpm_alg_.update_repair();
|
|||
|
|
|
|||
|
|
// time_t timep_;
|
|||
|
|
// std::tm* now_tm_p_;
|
|||
|
|
// time(&timep_); //获取从1970至今过了多少秒,存入time_t类型的timep
|
|||
|
|
// now_tm_p_ = localtime(&timep_); //用localtime将秒数转化为struct tm结构体
|
|||
|
|
// if (now_tm_p_->tm_hour == this->hour_point_ &&
|
|||
|
|
// now_tm_p_->tm_min == minute_point_) {
|
|||
|
|
// this->eqpm_alg_.update_repair();
|
|||
|
|
// }
|
|||
|
|
if (eventNo == 0) {
|
|||
|
|
this->eqpm_alg_.update_repair();
|
|||
|
|
}
|
|||
|
|
if (eventNo == 1) {
|
|||
|
|
Jvalue = eqp_status_.get_eqp_status();
|
|||
|
|
this->logger_->Debug()<<Jvalue.c_str()<<endl;
|
|||
|
|
auto reSult = m_memclient.Insert(Jkey.c_str(), Jvalue.c_str());
|
|||
|
|
if (1 != reSult) {
|
|||
|
|
this->logger_->Debug() << "eqp_status"
|
|||
|
|
<< "m_memclient.Insert异常[0,set data "
|
|||
|
|
"fail;-1,key=null or value=null]:"
|
|||
|
|
<< reSult << std::endl;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (eventNo == 2) {
|
|||
|
|
eqp_status_.update_alarm_info();
|
|||
|
|
}
|
|||
|
|
if (eventNo == 3) {
|
|||
|
|
eqp_status_.update_coil_info();
|
|||
|
|
}
|
|||
|
|
}
|