modify for ledgerupdate

This commit is contained in:
lnk
2025-02-10 17:03:15 +08:00
parent 3a37ce9c5b
commit faaef4f166
6 changed files with 185 additions and 28 deletions

View File

@@ -1197,6 +1197,10 @@ std::string prepare_update(const std::string& code_str, const terminal& json_dat
add_indent(xmlStream, indentLevel);
xmlStream << "<series>" << json_data.dev_series << "</series>" << std::endl;
//lnk20250210
add_indent(xmlStream, indentLevel);
xmlStream << "<processNo>" << json_data.processNo << "</processNo>" << std::endl;
add_indent(xmlStream, indentLevel);
xmlStream << "<devKey>" << json_data.dev_key << "</devKey>" << std::endl;
@@ -1426,6 +1430,11 @@ void parse_control(const std::string& json_str, const std::string& output_dir) {
else
std::strncpy(json_data.dev_series, "N/A", sizeof(json_data.dev_series) - 1);
//lnk20250210̨<30>˽<EFBFBD><CBBD>̺<EFBFBD>
cJSON* processNo = cJSON_GetObjectItem(item, "processNo"); // processNoתΪ<D7AA>ַ<EFBFBD><D6B7><EFBFBD>
if (processNo && processNo->type == cJSON_Number) snprintf(json_data.processNo, sizeof(json_data.processNo), "%d", processNo->valueint);
else strncpy(json_data.processNo, "N/A", sizeof(json_data.processNo) - 1);
cJSON* ip = cJSON_GetObjectItem(item, "ip"); // addr_str
if (ip && ip->type == cJSON_String)
std::strncpy(json_data.addr_str, ip->valuestring, sizeof(json_data.addr_str) - 1);