add debug print

This commit is contained in:
lnk
2026-02-02 10:39:27 +08:00
parent fe8ba6fad9
commit 1bc32ae38c

View File

@@ -1038,9 +1038,46 @@ void printCTopicList(const std::list<CTopic*>& ctopic_list) {
}
}
// ===== DEBUG 打印: mms_str_map (属性名 -> 值) =====
static void print_mms_str_map(const json_block_data* data)
{
if (!data) {
std::cout << "[DBG] json_block_data is NULL\n";
return;
}
std::cout << "\n========== [DBG] json_block_data.mms_str_map ==========\n";
std::cout << "[DBG] monitorId=" << data->monitorId
<< " func_type=" << data->func_type
<< " flag=" << data->flag
<< " time(ms)=" << data->time
<< " voltage_level=" << data->voltage_level
<< "\n";
std::cout << "[DBG] mp_id=" << data->mp_id.toStdString()
<< " dev_type=" << data->dev_type.toStdString()
<< "\n";
std::cout << "[DBG] mms_str_map size=" << data->mms_str_map.size() << "\n";
// Qt4/Qt5 都稳QMapIterator
QMapIterator<QString, double> it(data->mms_str_map);
while (it.hasNext()) {
it.next();
std::cout << " " << it.key().toStdString() << " = " << it.value() << "\n";
}
std::cout << "======================================================\n\n";
}
//20250214添加角型接线处理
int transfer_json_block_data(char v_wiring_type[], json_block_data *data) //json生成函数 zw修改 2023-8-11 调整传送json结构 目前仅限历史稳态数据
{
// 刚进函数就打印 mms_str_map
if (DEBUGOPEN) {
print_mms_str_map(data);
}
list<CTopic*> ctopic_list;
////lnk2024-8-15 区分星型,角型接线
@@ -1063,7 +1100,7 @@ int transfer_json_block_data(char v_wiring_type[], json_block_data *data) //json
cout << "transfer_json_block_data contain data->dev_type" << endl;
ctopic_list = xmlinfo_list2[data->dev_type]->topicList;
if(DEBUGOPEN)printCTopicList(ctopic_list);
}
else {
cout << "transfer_json_block_data not contain data->dev_type:" << data->dev_type.toStdString() << " !!!!"<< endl;
@@ -1072,6 +1109,8 @@ int transfer_json_block_data(char v_wiring_type[], json_block_data *data) //json
}
}
if(DEBUGOPEN)printCTopicList(ctopic_list);
//lnk20260127 添加数据类型区分
bool typeofdata = false;