增加了MOOSDB消息的订阅和处理函数

This commit is contained in:
zjk
2025-02-19 22:03:27 +08:00
parent 75575f935c
commit d89a1936ee
7 changed files with 117 additions and 100 deletions
+20 -3
View File
@@ -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);
}
+1 -1
View File
@@ -175,7 +175,7 @@ class PowerManger : public AppCastingMOOSApp
//故障处理
FSM_State m_Fault_s99;
static int handleFault_s99(FSM_State &fsm, void* pData);
//======================================================================================
};
#endif