增加调试页面

This commit is contained in:
zjk
2025-05-21 13:15:31 +08:00
parent af8e7a1ed1
commit 3e38fca181
6 changed files with 523 additions and 1 deletions
+43
View File
@@ -17,6 +17,9 @@ UpperCommManager::UpperCommManager(PowerManger* pm) : m_pm(pm) {
bool UpperCommManager::processUpperMsg(const string& key, const string& strJson) {
if (key == m_sysStateMsg.key)
{
#ifdef _DEBUG
m_sysStateMsg_st_debug = std::make_pair(key, strJson);
#endif
m_pm->m_msCmd = m_sysStateMsg.getMasterControlCmd(key, strJson);
MasterCommandEvent event;
PowerManagerFsm::dispatch(event);
@@ -25,6 +28,9 @@ bool UpperCommManager::processUpperMsg(const string& key, const string& strJson)
// 设备状态处理
else if(key == m_equStateMsg.key_cmd)
{
#ifdef _DEBUG
m_equStateMsg_cmd_debug = std::make_pair(key, strJson);
#endif
m_pm->m_MSDriverCmd = m_equStateMsg.getEquipmentCmd(key, strJson);
vector<DriverCommand> devCmdExt = m_pm->m_driver.loadDriverIdFromJson(strJson);
if (devCmdExt.empty())
@@ -42,6 +48,9 @@ bool UpperCommManager::processUpperMsg(const string& key, const string& strJson)
// 次级配电状态处理
else if(key == m_secdistStateMsg.key_fb)
{
#ifdef _DEBUG
m_secdistStateMsg_fb_debug = std::make_pair(key, strJson);
#endif
m_secdistStateMsg.parseMsg(strJson, m_pm->m_subDisSysState);
//debug 接受到次级配电状态,自动更新到设备状态
//TODO:自动更新到设备状态
@@ -51,11 +60,17 @@ bool UpperCommManager::processUpperMsg(const string& key, const string& strJson)
// 深度获取
else if(key == m_depthMsg.key)
{
#ifdef _DEBUG
m_depthMsg_st_debug = std::make_pair(key, strJson);
#endif
m_pm->m_depth = m_depthMsg.getDepth(key, strJson);
return true;
}
else if(key == m_taskStartMsg.key)
{
#ifdef _DEBUG
m_taskStartMsg_st_debug = std::make_pair(key, strJson);
#endif
m_pm->m_missionState = m_taskStartMsg.getMission(key, strJson);
TaskStartEvent event;
event.type = m_pm->m_missionState.type;
@@ -66,18 +81,27 @@ bool UpperCommManager::processUpperMsg(const string& key, const string& strJson)
}
else if(key == m_setOpModeMsg.key)
{
#ifdef _DEBUG
m_setOpModeMsg_st_debug = std::make_pair(key, strJson);
#endif
m_pm->m_msCmd.modCMD = m_setOpModeMsg.getSetOpMode(key, strJson);
MasterCommandEvent event;
PowerManagerFsm::dispatch(event);
return true;
} else if(key == m_setOpConditionMsg.key)
{
#ifdef _DEBUG
m_setOpConditionMsg_st_debug = std::make_pair(key, strJson);
#endif
m_pm->m_msCmd.workCMD = m_setOpConditionMsg.getSetOpCondition(key, strJson);
MasterCommandEvent event;
PowerManagerFsm::dispatch(event);
}
else if(key == m_setPMSysMsg.key)
{
#ifdef _DEBUG
m_setPMSysMsg_st_debug = std::make_pair(key, strJson);
#endif
m_pm->m_msCmd.powerCMD = m_setPMSysMsg.getSetPMSys(key, strJson);
MasterCommandEvent event;
PowerManagerFsm::dispatch(event);
@@ -85,6 +109,9 @@ bool UpperCommManager::processUpperMsg(const string& key, const string& strJson)
}
else if(key == m_setDevSwitchMsg.key)
{
#ifdef _DEBUG
m_setDevSwitchMsg_st_debug = std::make_pair(key, strJson);
#endif
DeviceSwitchCmd cmd;
cmd = m_setDevSwitchMsg.getSetDevSwitch(key, strJson);
if (cmd.id < 0) {
@@ -102,6 +129,9 @@ bool UpperCommManager::processUpperMsg(const string& key, const string& strJson)
}
else if(key == m_taskStopMsg.key)
{
#ifdef _DEBUG
m_taskStopMsg_st_debug = std::make_pair(key, strJson);
#endif
bool stop = m_taskStopMsg.getTaskStop(key, strJson);
if (stop) {
LOG_F(INFO, "task stop success");
@@ -128,6 +158,11 @@ void UpperCommManager::processPeriodicTasks() {
m_pm->sendNotification(m_secdistStateMsg.key_cmd, strJson);
//发送仪表电状态
m_pm->sendNotification(m_equInsStateMsg.key,m_equInsStateMsg.buildMsg(m_pm->m_subDisSysState));
#ifdef _DEBUG
m_equInsStateMsg_fb_degub = std::make_pair(m_equInsStateMsg.key,m_equInsStateMsg.buildMsg(m_pm->m_subDisSysState));
m_secdistStateMsg_cmd_debug = std::make_pair(m_secdistStateMsg.key_cmd,strJson);
m_equStateMsg_fb_debug = std::make_pair(m_equStateMsg.key_cmd,m_equStateMsg.buildMsg(m_pm->m_currentDriverState));
#endif
}
void UpperCommManager::buildSystemReport() {
@@ -147,4 +182,12 @@ void UpperCommManager::buildSystemReport() {
m_pm->sendNotification(m_liBatStateMsg.key, m_liBatStateMsg.buildMsg(*(m_pm->m_systemData)));
m_pm->sendNotification(m_disSysStateMsg.key, m_disSysStateMsg.buildMsg(*(m_pm->m_systemData),m_pm->m_currentDisBreakerState));
m_pm->sendNotification(m_currentStateMsg.key, m_currentStateMsg.buildMsg(m_pm->m_pmCurrentState));
#ifdef _DEBUG
m_pmStateMsg_fb_debug = std::make_pair(m_pmStateMsg.key, m_pmStateMsg.buildMsg());
m_fcsStateMsg_st_debug = std::make_pair(m_fcsStateMsg.key, m_fcsStateMsg.buildMsg(*(m_pm->m_systemData)));
m_liBatStateMsg_st_debug = std::make_pair(m_liBatStateMsg.key, m_liBatStateMsg.buildMsg(*(m_pm->m_systemData)));
m_disSysStateMsg_st_debug = std::make_pair(m_disSysStateMsg.key, m_disSysStateMsg.buildMsg(*(m_pm->m_systemData),m_pm->m_currentDisBreakerState));
m_currentStateMsg_st_debug = std::make_pair(m_currentStateMsg.key, m_currentStateMsg.buildMsg(m_pm->m_pmCurrentState));
#endif
}