feat: Output Unit and EVErrorCode as numeric values instead of strings
- Remove get_unit_string() and get_error_string() helper functions - Output Unit values as numbers (3=A, 4=V, 5=W, 2=s) instead of letters - Output EVErrorCode as numbers (0) instead of strings (NO_ERROR) - Maintain compatibility with Wireshark XML format structure - Add build.bat for easy compilation - Improve SessionID parsing for namespaced XML tags This ensures decoded EXI outputs preserve original numeric values rather than converting them to human-readable strings. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -139,6 +139,27 @@ int parse_xml_to_iso1(const char* xml_content, struct iso1EXIDocument* doc) {
|
|||||||
doc->V2G_Message.Header.SessionID.bytesLen = len;
|
doc->V2G_Message.Header.SessionID.bytesLen = len;
|
||||||
doc->V2G_Message_isUsed = 1;
|
doc->V2G_Message_isUsed = 1;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// Search directly for namespaced SessionID
|
||||||
|
char* ns_start = strstr(xml_content, "<ns2:SessionID>");
|
||||||
|
if (ns_start) {
|
||||||
|
ns_start += strlen("<ns2:SessionID>");
|
||||||
|
char* ns_end = strstr(ns_start, "</ns2:SessionID>");
|
||||||
|
if (ns_end) {
|
||||||
|
size_t len_str = ns_end - ns_start;
|
||||||
|
static char session_id_temp[256];
|
||||||
|
if (len_str < sizeof(session_id_temp)) {
|
||||||
|
strncpy(session_id_temp, ns_start, len_str);
|
||||||
|
session_id_temp[len_str] = '\0';
|
||||||
|
session_id_str = trim_whitespace(session_id_temp);
|
||||||
|
size_t len;
|
||||||
|
if (parse_session_id(session_id_str, doc->V2G_Message.Header.SessionID.bytes, &len) == 0) {
|
||||||
|
doc->V2G_Message.Header.SessionID.bytesLen = len;
|
||||||
|
doc->V2G_Message_isUsed = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for CurrentDemandReq
|
// Check for CurrentDemandReq
|
||||||
@@ -590,10 +611,13 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
// Parse XML to ISO1 document structure
|
// Parse XML to ISO1 document structure
|
||||||
if (parse_xml_to_iso1(xml_content, &iso1Doc) != 0) {
|
if (parse_xml_to_iso1(xml_content, &iso1Doc) != 0) {
|
||||||
printf("Error parsing XML file\\n");
|
printf("Error parsing XML file - no supported message type found\\n");
|
||||||
free(xml_content);
|
free(xml_content);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
fprintf(stderr, "XML parsing successful\\n");
|
||||||
|
fprintf(stderr, "SessionID length: %d\\n", iso1Doc.V2G_Message.Header.SessionID.bytesLen);
|
||||||
|
fprintf(stderr, "CurrentDemandReq_isUsed: %s\\n", iso1Doc.V2G_Message.Body.CurrentDemandReq_isUsed ? "true" : "false");
|
||||||
|
|
||||||
free(xml_content);
|
free(xml_content);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user