增加了MOOSDB消息的订阅和处理函数
This commit is contained in:
@@ -92,11 +92,10 @@ bool PowerManger::OnNewMail(MOOSMSG_LIST &NewMail)
|
||||
{
|
||||
CMOOSMsg &msg = *p;
|
||||
string key = msg.GetKey();
|
||||
|
||||
string strJson = msg.GetString();
|
||||
//处理上位机发送的控制指令
|
||||
if(key == DB_TO_PM_MSCMD)
|
||||
{
|
||||
string strJson = msg.GetString();
|
||||
if(getMsCmdFromJson(m_msCmd,strJson))
|
||||
{
|
||||
cout << "get ms cmd:" << strJson << endl;
|
||||
@@ -106,7 +105,23 @@ bool PowerManger::OnNewMail(MOOSMSG_LIST &NewMail)
|
||||
cout << "get ms cmd error:" << strJson << endl;
|
||||
}
|
||||
}
|
||||
|
||||
//处理设备上电指令
|
||||
if (key == DB_TO_PM_EQUIPMENTCMD)
|
||||
{
|
||||
if(m_driver.loadDriverTableFromJson(strJson,m_subDisSysCmd) < 0)
|
||||
{
|
||||
cout << "get sub dis cmd error:" << strJson << endl;
|
||||
}
|
||||
}
|
||||
//处理设备状态反馈
|
||||
if(key == DB_TO_PM_SUBDISSTATE)
|
||||
{
|
||||
if(m_driver.loadDriverTableFromJson(strJson,m_subDisSysState) < 0)
|
||||
{
|
||||
cout << "get sub dis state error:" << strJson << endl;
|
||||
}
|
||||
}
|
||||
|
||||
#if 0 // Keep these around just for template
|
||||
string comm = msg.GetCommunity();
|
||||
double dval = msg.GetDouble();
|
||||
@@ -243,6 +258,8 @@ void PowerManger::registerVariables()
|
||||
{
|
||||
AppCastingMOOSApp::RegisterVariables();
|
||||
Register(DB_TO_PM_MSCMD, 0);
|
||||
Register(DB_TO_PM_EQUIPMENTCMD, 0);
|
||||
Register(DB_TO_PM_SUBDISSTATE, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -175,7 +175,7 @@ class PowerManger : public AppCastingMOOSApp
|
||||
//故障处理
|
||||
FSM_State m_Fault_s99;
|
||||
static int handleFault_s99(FSM_State &fsm, void* pData);
|
||||
|
||||
//======================================================================================
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user