76 lines
1.9 KiB
C++
76 lines
1.9 KiB
C++
#include <QApplication>
|
|
#include "CAlarmPlugin.h"
|
|
#include "pub_logger_api/logger.h"
|
|
#include "net_msg_bus_api/MsgBusApi.h"
|
|
#include "dp_chg_data_api/CDpcdaForApp.h"
|
|
#include "service/perm_mng_api/PermMngApi.h"
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
QApplication app(argc, argv);
|
|
|
|
//<初始化消息总线
|
|
QStringList arguments=QCoreApplication::arguments();
|
|
std::string name="admin";
|
|
std::string password ="kbdct";
|
|
int group =1;
|
|
for(int index(0);index<arguments.size();index++)
|
|
{
|
|
if(arguments.at(index) == "-username")
|
|
{
|
|
if(index+1<arguments.size())
|
|
{
|
|
QString st = arguments.at(index+1);
|
|
name =st.toStdString();
|
|
}
|
|
}
|
|
if(arguments.at(index) == "-password")
|
|
{
|
|
if(index+1<arguments.size())
|
|
{
|
|
QString st = arguments.at(index+1);
|
|
password =st.toStdString();
|
|
}
|
|
}
|
|
if(arguments.at(index) == "-group")
|
|
{
|
|
if(index+1<arguments.size())
|
|
{
|
|
QString st = arguments.at(index+1);
|
|
group =st.toInt();
|
|
}
|
|
}
|
|
}
|
|
kbd_public::StartLogSystem("HMI", "hmi");
|
|
if (!(kbd_net::initMsgBus("HMI", "HMI")))
|
|
{
|
|
return -1;
|
|
}
|
|
kbd_service::CPermMngApiPtr perm = kbd_service::getPermMngInstance("base");
|
|
if(!perm || PERM_NORMAL != perm->PermDllInit())
|
|
{
|
|
return -1;
|
|
}
|
|
|
|
if(perm->SysLogin(name, password, group, 12*60*60, "hmi") != 0)
|
|
{
|
|
return -1;
|
|
}
|
|
|
|
{
|
|
CAlarmPlugin n(NULL, false);
|
|
n.initialize(E_Alarm_Dock);
|
|
//n.initialize(E_Alarm_Window);
|
|
|
|
n.show();
|
|
app.exec();
|
|
}
|
|
|
|
//<释放消息总线
|
|
kbd_net::releaseMsgBus();
|
|
kbd_public::StopLogSystem();
|
|
|
|
return 0;
|
|
}
|
|
|