Bladeren bron

Added property "EXICodec" in EVCCConfig.properties and SECCConfig.properties to set the EXI codec. Changed the handling in the constructor of the MessageHandler.java accordingly.

Marc Mültin 8 jaren geleden
bovenliggende
commit
7cd067c118

+ 11 - 0
RISE-V2G-EVCC/EVCCConfig.properties

@@ -104,3 +104,14 @@ XMLRepresentationOfMessages = true
 # If this value is set to 'true', extended logging will be printed upon verification of signatures (for debugging purposes) 
 # If no correct value is provided here, 'false' will be chosen
 SignatureVerificationLog = true
+
+
+# EXI codec
+#--------------------------------
+#
+# This (single!) value tells the program which EXI codec to use to en-/decode EXI messages
+# Possible values are:
+# - exificient
+# - open_exi
+# If no correct value is provided here, 'exificient' will be used
+EXICodec = open_exi

+ 10 - 0
RISE-V2G-SECC/SECCConfig.properties

@@ -98,3 +98,13 @@ XMLRepresentationOfMessages = true
 # If no correct value is provided here, 'false' will be chosen
 SignatureVerificationLog = true
 
+
+# EXI codec
+#--------------------------------
+#
+# This (single!) value tells the program which EXI codec to use to en-/decode EXI messages
+# Possible values are:
+# - exificient
+# - open_exi
+# If no correct value is provided here, 'exificient' will be used
+EXICodec = exificient

+ 7 - 3
RISE-V2G-Shared/src/main/java/org/v2gclarity/risev2g/shared/messageHandling/MessageHandler.java

@@ -39,9 +39,11 @@ import org.apache.logging.log4j.LogManager;
 import org.v2gclarity.risev2g.shared.enumerations.GlobalValues;
 import org.v2gclarity.risev2g.shared.exiCodec.EXIficientCodec;
 import org.v2gclarity.risev2g.shared.exiCodec.ExiCodec;
+import org.v2gclarity.risev2g.shared.exiCodec.OpenEXICodec;
 import org.v2gclarity.risev2g.shared.misc.V2GCommunicationSession;
 import org.v2gclarity.risev2g.shared.misc.V2GTPMessage;
 import org.v2gclarity.risev2g.shared.utils.ByteUtils;
+import org.v2gclarity.risev2g.shared.utils.MiscUtils;
 import org.v2gclarity.risev2g.shared.utils.SecurityUtils;
 import org.v2gclarity.risev2g.shared.v2gMessages.appProtocol.SupportedAppProtocolReq;
 import org.v2gclarity.risev2g.shared.v2gMessages.appProtocol.SupportedAppProtocolRes;
@@ -84,9 +86,11 @@ public class MessageHandler {
 	 * This constructor is used by V2GCommunicationSessionHandlerEVCC and -SECC
 	 */
 	public MessageHandler() {
-		// Choose which implementation of an EXI codec to use
-		setExiCodec(EXIficientCodec.getInstance());
-//		setExiCodec(OpenEXICodec.getInstance());
+		// Choose which implementation of an EXI codec to use in the respective properties file
+		String exiCodecChoice = (String) MiscUtils.getPropertyValue("EXICodec");
+		
+		if (exiCodecChoice.equals("open_exi")) setExiCodec(OpenEXICodec.getInstance());
+		else setExiCodec(EXIficientCodec.getInstance());
 		
 		setJaxbContext(SupportedAppProtocolReq.class, SupportedAppProtocolRes.class, V2GMessage.class);
 		setCurrentJaxbContext(jaxbContextEnum.SUPPORTED_APP_PROTOCOL_REQ);

+ 4 - 0
RISE-V2G-Shared/src/main/java/org/v2gclarity/risev2g/shared/utils/MiscUtils.java

@@ -229,6 +229,10 @@ public final class MiscUtils {
 			if (Boolean.parseBoolean(propertyValue)) returnValue = true;
 			else returnValue = false;
 			break;
+		case "EXICodec": // EV + EVSE property
+			if (propertyValue.equals("open_exi")) returnValue = "open_exi";
+			else returnValue = "exificient";
+			break;
 		default:
 			getLogger().error("No property with name '" + propertyName + "' found");
 		}