Skip to content

Commit 9bd4e22

Browse files
JavaIsJavaScriptgoekay
authored andcommitted
Added new ConfigurationKeys from 1.6 (steve-community#42)
Added the new ConfigurationKeys from 1.6, using a new Enum we check if they are Read-Only or Read-Write since some new ConfigurationKeys in 1.6 are Read-Only. "Read-Only" can only be used in GetConfiguration whilst "Read-Write" can be used at ChangeConfiguration and GetConfiguration.
1 parent d01da0a commit 9bd4e22

2 files changed

Lines changed: 78 additions & 19 deletions

File tree

src/main/java/de/rwth/idsg/steve/web/dto/ocpp/ConfigurationKeyEnum.java

Lines changed: 66 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,40 +9,84 @@
99
import static com.google.common.collect.Sets.newHashSet;
1010
import static de.rwth.idsg.steve.ocpp.OcppVersion.V_12;
1111
import static de.rwth.idsg.steve.ocpp.OcppVersion.V_15;
12+
import static de.rwth.idsg.steve.ocpp.OcppVersion.V_16;
13+
import static de.rwth.idsg.steve.web.dto.ocpp.ConfigurationKeyReadWriteEnum.R;
14+
import static de.rwth.idsg.steve.web.dto.ocpp.ConfigurationKeyReadWriteEnum.RW;
1215

1316
/**
1417
* @author Sevket Goekay <goekay@dbis.rwth-aachen.de>
1518
* @since 02.01.2015
1619
*/
1720
public enum ConfigurationKeyEnum {
1821
// From Ocpp 1.2
19-
HeartBeatInterval("HeartBeatInterval", "in seconds", newHashSet(V_12, V_15)),
20-
ConnectionTimeOut("ConnectionTimeOut", "in seconds", newHashSet(V_12, V_15)),
21-
ProximityContactRetries("ProximityContactRetries", "in times", newHashSet(V_12, V_15)),
22-
ProximityLockRetries("ProximityLockRetries", "in times", newHashSet(V_12, V_15)),
23-
ResetRetries("ResetRetries", "in times", newHashSet(V_12, V_15)),
24-
BlinkRepeat("BlinkRepeat", "in times", newHashSet(V_12, V_15)),
25-
LightIntensity("LightIntensity", "in %", newHashSet(V_12, V_15)),
26-
ChargePointId("ChargePointId", "string", newHashSet(V_12, V_15)),
27-
MeterValueSampleInterval("MeterValueSampleInterval", "in seconds", newHashSet(V_12, V_15)),
22+
HeartBeatInterval("HeartBeatInterval", "in seconds", RW , newHashSet(V_12, V_15, V_16)),
23+
ConnectionTimeOut("ConnectionTimeOut", "in seconds", RW , newHashSet(V_12, V_15, V_16)),
24+
ProximityContactRetries("ProximityContactRetries", "in times", RW , newHashSet(V_12, V_15, V_16)),
25+
ProximityLockRetries("ProximityLockRetries", "in times", RW , newHashSet(V_12, V_15, V_16)),
26+
ResetRetries("ResetRetries", "in times", RW , newHashSet(V_12, V_15, V_16)),
27+
BlinkRepeat("BlinkRepeat", "in times", RW , newHashSet(V_12, V_15, V_16)),
28+
LightIntensity("LightIntensity", "in %", RW , newHashSet(V_12, V_15, V_16)),
29+
ChargePointId("ChargePointId", "string", RW , newHashSet(V_12, V_15, V_16)),
30+
MeterValueSampleInterval("MeterValueSampleInterval", "in seconds", RW , newHashSet(V_12, V_15, V_16)),
2831

2932
// New in Ocpp 1.5
30-
ClockAlignedDataInterval("ClockAlignedDataInterval", "in seconds", newHashSet(V_15)),
31-
MeterValuesSampledData("MeterValuesSampledData", "comma seperated list", newHashSet(V_15)),
32-
MeterValuesAlignedData("MeterValuesAlignedData", "comma seperated list", newHashSet(V_15)),
33-
StopTxnSampledData("StopTxnSampledData", "comma seperated list", newHashSet(V_15)),
34-
StopTxnAlignedData("StopTxnAlignedData", "comma seperated list", newHashSet(V_15));
33+
ClockAlignedDataInterval("ClockAlignedDataInterval", "in seconds", RW , newHashSet(V_15, V_16)),
34+
MeterValuesSampledData("MeterValuesSampledData", "comma seperated list", RW , newHashSet(V_15, V_16)),
35+
MeterValuesAlignedData("MeterValuesAlignedData", "comma seperated list", RW , newHashSet(V_15, V_16)),
36+
StopTxnSampledData("StopTxnSampledData", "comma seperated list", RW , newHashSet(V_15, V_16)),
37+
StopTxnAlignedData("StopTxnAlignedData", "comma seperated list", RW , newHashSet(V_15, V_16)),
38+
39+
// New in Ocpp 1.6
40+
AllowOfflineTxForUnknownId("AllowOfflineTxForUnknownId", "boolean", RW , newHashSet(V_16)),
41+
AuthorizationCacheEnabled("AuthorizationCacheEnabled", "boolean", RW , newHashSet(V_16)),
42+
//AuthorizeRemoteTxRequests Read or Read-Write is up to Charge Point implementation so set to RW for now
43+
AuthorizeRemoteTxRequests("AuthorizeRemoteTxRequests", "boolean", RW , newHashSet(V_16)),
44+
ConnectorPhaseRotation("ConnectorPhaseRotation", "comma seperated list", RW , newHashSet(V_16)),
45+
ConnectorPhaseRotationMaxLength("ConnectorPhaseRotationMaxLength", "integer", R , newHashSet(V_16)),
46+
GetConfigurationMaxKeys("GetConfigurationMaxKeys", "integer", R , newHashSet(V_16)),
47+
LocalAuthorizeOffline("LocalAuthorizeOffline", "boolean", RW , newHashSet(V_16)),
48+
LocalPreAuthorize("LocalPreAuthorize", "boolean", RW , newHashSet(V_16)),
49+
MaxEnergyOnInvalidId("MaxEnergyOnInvalidId", "in Wh", RW , newHashSet(V_16)),
50+
MeterValuesAlignedDataMaxLength("MeterValuesAlignedDataMaxLength", "integer", R , newHashSet(V_16)),
51+
MeterValuesSampledDataMaxLength("MeterValuesSampledDataMaxLength", "integer", R , newHashSet(V_16)),
52+
MinimumStatusDuration("MinimumStatusDuration", "in seconds", RW , newHashSet(V_16)),
53+
NumberOfConnectors("NumberOfConnectors", "integer", R , newHashSet(V_16)),
54+
StopTransactionOnEVSideDisconnect("StopTransactionOnEVSideDisconnect", "boolean", RW , newHashSet(V_16)),
55+
StopTransactionOnInvalidId("StopTransactionOnInvalidId", "boolean", RW , newHashSet(V_16)),
56+
StopTxnAlignedDataMaxLength("StopTxnAlignedDataMaxLength", "integer", R , newHashSet(V_16)),
57+
StopTxnSampledDataMaxLength("StopTxnSampledDataMaxLength", "integer", R , newHashSet(V_16)),
58+
SupportedFeatureProfiles("SupportedFeatureProfiles", "comma seperated list", R , newHashSet(V_16)),
59+
SupportedFeatureProfilesMaxLength("SupportedFeatureProfilesMaxLength", "integer", R , newHashSet(V_16)),
60+
TransactionMessageAttempts("TransactionMessageAttempts", "in times", RW , newHashSet(V_16)),
61+
TransactionMessageRetryInterval("TransactionMessageRetryInterval", "in seconds", RW , newHashSet(V_16)),
62+
UnlockConnectorOnEVSideDisconnect("UnlockConnectorOnEVSideDisconnect", "boolean", RW , newHashSet(V_16)),
63+
WebSocketPingInterval("WebSocketPingInterval", "in seconds", RW , newHashSet(V_16)),
64+
LocalAuthListEnabled("LocalAuthListEnabled", "boolean", RW , newHashSet(V_16)),
65+
LocalAuthListMaxLength("LocalAuthListMaxLength", "integer", R , newHashSet(V_16)),
66+
SendLocalListMaxLength("SendLocalListMaxLength", "integer", R , newHashSet(V_16)),
67+
ReserveConnectorZeroSupported("ReserveConnectorZeroSupported", "boolean", R , newHashSet(V_16)),
68+
ChargeProfileMaxStackLevel("ChargeProfileMaxStackLevel", "integer", R , newHashSet(V_16)),
69+
ChargingScheduleAllowedChargingRateUnit("ChargingScheduleAllowedChargingRateUnit", "comma seperated list", R , newHashSet(V_16)),
70+
ChargingScheduleMaxPeriods("ChargingScheduleMaxPeriods", "integer", R , newHashSet(V_16)),
71+
ConnectorSwitch3to1PhaseSupported("ConnectorSwitch3to1PhaseSupported", "boolean", R , newHashSet(V_16)),
72+
MaxChargingProfilesInstalled("MaxChargingProfilesInstalled", "integer", R , newHashSet(V_16));
3573

3674
private final String value;
3775
private final String text;
76+
private final ConfigurationKeyReadWriteEnum rw;
3877
private final Set<OcppVersion> versions;
3978

40-
public static final Map<String, String> OCPP_12_MAP = asMap(OcppVersion.V_12);
41-
public static final Map<String, String> OCPP_15_MAP = asMap(OcppVersion.V_15);
79+
public static final Map<String, String> OCPP_12_MAP = asMap(OcppVersion.V_12, RW);
80+
public static final Map<String, String> OCPP_15_MAP = asMap(OcppVersion.V_15, RW);
81+
82+
// In OCPP 1.6 some Configuration Keys are Read-Only
83+
public static final Map<String, String> OCPP_16_MAP_R = asMap(OcppVersion.V_16, R);
84+
public static final Map<String, String> OCPP_16_MAP_RW = asMap(OcppVersion.V_16, RW);
4285

43-
ConfigurationKeyEnum(String value, String comment, Set<OcppVersion> versions) {
86+
ConfigurationKeyEnum(String value, String comment, ConfigurationKeyReadWriteEnum rw, Set<OcppVersion> versions) {
4487
this.value = value;
4588
this.text = String.format("%s (%s)", value, comment);
89+
this.rw = rw;
4690
this.versions = versions;
4791
}
4892

@@ -59,10 +103,13 @@ public static ConfigurationKeyEnum fromValue(String v) {
59103
throw new IllegalArgumentException(v);
60104
}
61105

62-
private static Map<String, String> asMap(OcppVersion version) {
106+
private static Map<String, String> asMap(OcppVersion version, ConfigurationKeyReadWriteEnum rw) {
63107
Map<String, String> map = new LinkedHashMap<>();
64108
for (ConfigurationKeyEnum c : ConfigurationKeyEnum.values()) {
65-
if (c.versions.contains(version)) {
109+
if (c.versions.contains(version) && c.rw == rw) {
110+
map.put(c.value, c.text);
111+
}
112+
else if (c.versions.contains(version) && rw == ConfigurationKeyReadWriteEnum.R){
66113
map.put(c.value, c.text);
67114
}
68115
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package de.rwth.idsg.steve.web.dto.ocpp;
2+
3+
//Determines if a configuration key is read-only ("R") or read-write
4+
//("RW"). In case the key is read-only, the Central System can read the value for the key using GetConfiguration, but
5+
//not write it. In case the accessibility is read-write, the Central System can also write the value for the key using
6+
//ChangeConfiguration.
7+
8+
public enum ConfigurationKeyReadWriteEnum
9+
{
10+
R,
11+
RW
12+
}

0 commit comments

Comments
 (0)