diff --git a/build.bat b/build.bat
new file mode 100644
index 0000000..733261a
--- /dev/null
+++ b/build.bat
@@ -0,0 +1,20 @@
+@echo off
+echo Building enhanced_exi_viewer...
+
+gcc -o enhanced_exi_viewer enhanced_exi_viewer.c ^
+ src/iso1/*.c ^
+ src/iso2/*.c ^
+ src/din/*.c ^
+ src/codec/*.c ^
+ -I./src/codec ^
+ -I./src/iso1 ^
+ -I./src/iso2 ^
+ -I./src/din
+
+if %ERRORLEVEL% EQU 0 (
+ echo Build successful! enhanced_exi_viewer.exe created.
+) else (
+ echo Build failed with error code %ERRORLEVEL%
+)
+
+pause
\ No newline at end of file
diff --git a/enhanced_exi_viewer.c b/enhanced_exi_viewer.c
index dc15afe..496fc34 100644
--- a/enhanced_exi_viewer.c
+++ b/enhanced_exi_viewer.c
@@ -281,23 +281,7 @@ int readEXIFile(char* file, uint8_t* buffer, size_t buffer_size, size_t *bytes_r
return 0;
}
-// Helper functions for Wireshark XML output
-const char* get_unit_string(int unit) {
- switch(unit) {
- case 2: return "s"; // seconds
- case 3: return "A"; // amperes
- case 4: return "V"; // volts
- case 5: return "W"; // watts
- default: return ""; // fallback to number
- }
-}
-
-const char* get_error_string(int error) {
- switch(error) {
- case 0: return "NO_ERROR";
- default: return ""; // fallback to number
- }
-}
+// Helper functions for Wireshark XML output removed - using numeric values directly
void print_xml_header_wireshark() {
printf("\n");
@@ -332,23 +316,13 @@ void print_iso1_xml_wireshark(struct iso1EXIDocument* doc) {
printf("");
printf("%d", doc->V2G_Message.Body.CurrentDemandRes.EVSEPresentVoltage.Multiplier);
- const char* unit_str = get_unit_string(doc->V2G_Message.Body.CurrentDemandRes.EVSEPresentVoltage.Unit);
- if (strlen(unit_str) > 0) {
- printf("%s", unit_str);
- } else {
- printf("%d", doc->V2G_Message.Body.CurrentDemandRes.EVSEPresentVoltage.Unit);
- }
+ printf("%d", doc->V2G_Message.Body.CurrentDemandRes.EVSEPresentVoltage.Unit);
printf("%d", doc->V2G_Message.Body.CurrentDemandRes.EVSEPresentVoltage.Value);
printf("");
printf("");
printf("%d", doc->V2G_Message.Body.CurrentDemandRes.EVSEPresentCurrent.Multiplier);
- unit_str = get_unit_string(doc->V2G_Message.Body.CurrentDemandRes.EVSEPresentCurrent.Unit);
- if (strlen(unit_str) > 0) {
- printf("%s", unit_str);
- } else {
- printf("%d", doc->V2G_Message.Body.CurrentDemandRes.EVSEPresentCurrent.Unit);
- }
+ printf("%d", doc->V2G_Message.Body.CurrentDemandRes.EVSEPresentCurrent.Unit);
printf("%d", doc->V2G_Message.Body.CurrentDemandRes.EVSEPresentCurrent.Value);
printf("");
@@ -366,47 +340,27 @@ void print_iso1_xml_wireshark(struct iso1EXIDocument* doc) {
printf("");
printf("%s", doc->V2G_Message.Body.CurrentDemandReq.DC_EVStatus.EVReady ? "true" : "false");
- const char* error_str = get_error_string(doc->V2G_Message.Body.CurrentDemandReq.DC_EVStatus.EVErrorCode);
- if (strlen(error_str) > 0) {
- printf("%s", error_str);
- } else {
- printf("%d", doc->V2G_Message.Body.CurrentDemandReq.DC_EVStatus.EVErrorCode);
- }
+ printf("%d", doc->V2G_Message.Body.CurrentDemandReq.DC_EVStatus.EVErrorCode);
printf("%d", doc->V2G_Message.Body.CurrentDemandReq.DC_EVStatus.EVRESSSOC);
printf("");
printf("");
printf("%d", doc->V2G_Message.Body.CurrentDemandReq.EVTargetCurrent.Multiplier);
- const char* unit_str = get_unit_string(doc->V2G_Message.Body.CurrentDemandReq.EVTargetCurrent.Unit);
- if (strlen(unit_str) > 0) {
- printf("%s", unit_str);
- } else {
- printf("%d", doc->V2G_Message.Body.CurrentDemandReq.EVTargetCurrent.Unit);
- }
+ printf("%d", doc->V2G_Message.Body.CurrentDemandReq.EVTargetCurrent.Unit);
printf("%d", doc->V2G_Message.Body.CurrentDemandReq.EVTargetCurrent.Value);
printf("");
printf("");
printf("%d", doc->V2G_Message.Body.CurrentDemandReq.EVTargetVoltage.Multiplier);
- unit_str = get_unit_string(doc->V2G_Message.Body.CurrentDemandReq.EVTargetVoltage.Unit);
- if (strlen(unit_str) > 0) {
- printf("%s", unit_str);
- } else {
- printf("%d", doc->V2G_Message.Body.CurrentDemandReq.EVTargetVoltage.Unit);
- }
+ printf("%d", doc->V2G_Message.Body.CurrentDemandReq.EVTargetVoltage.Unit);
printf("%d", doc->V2G_Message.Body.CurrentDemandReq.EVTargetVoltage.Value);
printf("");
if (doc->V2G_Message.Body.CurrentDemandReq.EVMaximumVoltageLimit_isUsed) {
printf("");
printf("%d", doc->V2G_Message.Body.CurrentDemandReq.EVMaximumVoltageLimit.Multiplier);
- unit_str = get_unit_string(doc->V2G_Message.Body.CurrentDemandReq.EVMaximumVoltageLimit.Unit);
- if (strlen(unit_str) > 0) {
- printf("%s", unit_str);
- } else {
- printf("%d", doc->V2G_Message.Body.CurrentDemandReq.EVMaximumVoltageLimit.Unit);
- }
+ printf("%d", doc->V2G_Message.Body.CurrentDemandReq.EVMaximumVoltageLimit.Unit);
printf("%d", doc->V2G_Message.Body.CurrentDemandReq.EVMaximumVoltageLimit.Value);
printf("");
}
@@ -414,12 +368,7 @@ void print_iso1_xml_wireshark(struct iso1EXIDocument* doc) {
if (doc->V2G_Message.Body.CurrentDemandReq.EVMaximumCurrentLimit_isUsed) {
printf("");
printf("%d", doc->V2G_Message.Body.CurrentDemandReq.EVMaximumCurrentLimit.Multiplier);
- unit_str = get_unit_string(doc->V2G_Message.Body.CurrentDemandReq.EVMaximumCurrentLimit.Unit);
- if (strlen(unit_str) > 0) {
- printf("%s", unit_str);
- } else {
- printf("%d", doc->V2G_Message.Body.CurrentDemandReq.EVMaximumCurrentLimit.Unit);
- }
+ printf("%d", doc->V2G_Message.Body.CurrentDemandReq.EVMaximumCurrentLimit.Unit);
printf("%d", doc->V2G_Message.Body.CurrentDemandReq.EVMaximumCurrentLimit.Value);
printf("");
}
@@ -427,12 +376,7 @@ void print_iso1_xml_wireshark(struct iso1EXIDocument* doc) {
if (doc->V2G_Message.Body.CurrentDemandReq.EVMaximumPowerLimit_isUsed) {
printf("");
printf("%d", doc->V2G_Message.Body.CurrentDemandReq.EVMaximumPowerLimit.Multiplier);
- unit_str = get_unit_string(doc->V2G_Message.Body.CurrentDemandReq.EVMaximumPowerLimit.Unit);
- if (strlen(unit_str) > 0) {
- printf("%s", unit_str);
- } else {
- printf("%d", doc->V2G_Message.Body.CurrentDemandReq.EVMaximumPowerLimit.Unit);
- }
+ printf("%d", doc->V2G_Message.Body.CurrentDemandReq.EVMaximumPowerLimit.Unit);
printf("%d", doc->V2G_Message.Body.CurrentDemandReq.EVMaximumPowerLimit.Value);
printf("");
}
@@ -446,12 +390,7 @@ void print_iso1_xml_wireshark(struct iso1EXIDocument* doc) {
if (doc->V2G_Message.Body.CurrentDemandReq.RemainingTimeToFullSoC_isUsed) {
printf("");
printf("%d", doc->V2G_Message.Body.CurrentDemandReq.RemainingTimeToFullSoC.Multiplier);
- unit_str = get_unit_string(doc->V2G_Message.Body.CurrentDemandReq.RemainingTimeToFullSoC.Unit);
- if (strlen(unit_str) > 0) {
- printf("%s", unit_str);
- } else {
- printf("%d", doc->V2G_Message.Body.CurrentDemandReq.RemainingTimeToFullSoC.Unit);
- }
+ printf("%d", doc->V2G_Message.Body.CurrentDemandReq.RemainingTimeToFullSoC.Unit);
printf("%d", doc->V2G_Message.Body.CurrentDemandReq.RemainingTimeToFullSoC.Value);
printf("");
}
@@ -459,12 +398,7 @@ void print_iso1_xml_wireshark(struct iso1EXIDocument* doc) {
if (doc->V2G_Message.Body.CurrentDemandReq.RemainingTimeToBulkSoC_isUsed) {
printf("");
printf("%d", doc->V2G_Message.Body.CurrentDemandReq.RemainingTimeToBulkSoC.Multiplier);
- unit_str = get_unit_string(doc->V2G_Message.Body.CurrentDemandReq.RemainingTimeToBulkSoC.Unit);
- if (strlen(unit_str) > 0) {
- printf("%s", unit_str);
- } else {
- printf("%d", doc->V2G_Message.Body.CurrentDemandReq.RemainingTimeToBulkSoC.Unit);
- }
+ printf("%d", doc->V2G_Message.Body.CurrentDemandReq.RemainingTimeToBulkSoC.Unit);
printf("%d", doc->V2G_Message.Body.CurrentDemandReq.RemainingTimeToBulkSoC.Value);
printf("");
}
diff --git a/enhanced_exi_viewer.exe b/enhanced_exi_viewer.exe
index 88cfaa4..2bd5906 100644
Binary files a/enhanced_exi_viewer.exe and b/enhanced_exi_viewer.exe differ
diff --git a/test5.xml b/test5.xml
index 86a975e..9e13340 100644
--- a/test5.xml
+++ b/test5.xml
@@ -1,53 +1,3 @@
-
-
-
-
-
- true
- 0
- 100
-
-
- 0
- 3
- 1
-
-
- 0
- 4
- 460
-
-
- 0
- 4
- 471
-
-
- 0
- 3
- 100
-
-
- 3
- 5
- 50
-
- false
- true
-
- 0
- 2
- 0
-
-
- 0
- 2
- 0
-
-
-
-
+
+4142423030303831true01000310446004471031003550falsetrue020020
\ No newline at end of file
diff --git a/test5_encoded.exi b/test5_encoded.exi
new file mode 100644
index 0000000..b649d9b
--- /dev/null
+++ b/test5_encoded.exi
@@ -0,0 +1 @@
+Error encoding to EXI (error: -109)\n
\ No newline at end of file
diff --git a/test5ws.xml b/test5ws.xml
new file mode 100644
index 0000000..0c06b91
--- /dev/null
+++ b/test5ws.xml
@@ -0,0 +1 @@
+4142423030303831trueNO_ERROR1000A10V4710A1003W50falsetrue0s00s00V460
\ No newline at end of file