Skip to content

Commit a546c1b

Browse files
committed
Add OCPP 2.1 support
Add Java classes for all OCPP 2.1 messages and types as well as client and server event handler interfaces and function classes corresponding to the OCPP 2.1 "functional blocks." Add OCPP 2.1 to the ProtocolVersion enum. Specify UTF-8 encoding for the Java source files in build.gradle to avoid compiler warnings about the UTF-8 sequences in the source files.
1 parent f27fe5b commit a546c1b

File tree

572 files changed

+98382
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

572 files changed

+98382
-1
lines changed

build.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ subprojects {
3232

3333
sourceCompatibility = '1.8'
3434

35+
tasks.withType(JavaCompile).configureEach {
36+
options.encoding = 'UTF-8'
37+
}
38+
3539
publishing {
3640
publications {
3741
maven(MavenPublication) {

ocpp-common/src/main/java/eu/chargetime/ocpp/ProtocolVersion.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
/** enum of protocol versions along with their registered WebSocket sub-protocol names */
3333
public enum ProtocolVersion {
3434
OCPP1_6("ocpp1.6"),
35-
OCPP2_0_1("ocpp2.0.1");
35+
OCPP2_0_1("ocpp2.0.1"),
36+
OCPP2_1("ocpp2.1");
3637

3738
private static final Map<String, ProtocolVersion> MAP = new HashMap<>();
3839

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
ChargeTime.eu - Java-OCA-OCPP
3+
4+
MIT License
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in all
14+
copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
SOFTWARE.
23+
*/
24+
25+
package eu.chargetime.ocpp.v21.feature;
26+
27+
import eu.chargetime.ocpp.feature.FunctionFeature;
28+
import eu.chargetime.ocpp.feature.function.Function;
29+
import eu.chargetime.ocpp.model.Confirmation;
30+
import eu.chargetime.ocpp.model.Request;
31+
import eu.chargetime.ocpp.v21.model.messages.AFRRSignalRequest;
32+
import eu.chargetime.ocpp.v21.model.messages.AFRRSignalResponse;
33+
34+
public class AFRRSignalFeature extends FunctionFeature {
35+
36+
public AFRRSignalFeature(Function ownerFunction) {
37+
super(ownerFunction);
38+
}
39+
40+
@Override
41+
public Class<? extends Request> getRequestType() {
42+
return AFRRSignalRequest.class;
43+
}
44+
45+
@Override
46+
public Class<? extends Confirmation> getConfirmationType() {
47+
return AFRRSignalResponse.class;
48+
}
49+
50+
@Override
51+
public String getAction() {
52+
return "AFRRSignal";
53+
}
54+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
ChargeTime.eu - Java-OCA-OCPP
3+
4+
MIT License
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in all
14+
copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
SOFTWARE.
23+
*/
24+
25+
package eu.chargetime.ocpp.v21.feature;
26+
27+
import eu.chargetime.ocpp.feature.FunctionFeature;
28+
import eu.chargetime.ocpp.feature.function.Function;
29+
import eu.chargetime.ocpp.model.Confirmation;
30+
import eu.chargetime.ocpp.model.Request;
31+
import eu.chargetime.ocpp.v21.model.messages.AdjustPeriodicEventStreamRequest;
32+
import eu.chargetime.ocpp.v21.model.messages.AdjustPeriodicEventStreamResponse;
33+
34+
public class AdjustPeriodicEventStreamFeature extends FunctionFeature {
35+
36+
public AdjustPeriodicEventStreamFeature(Function ownerFunction) {
37+
super(ownerFunction);
38+
}
39+
40+
@Override
41+
public Class<? extends Request> getRequestType() {
42+
return AdjustPeriodicEventStreamRequest.class;
43+
}
44+
45+
@Override
46+
public Class<? extends Confirmation> getConfirmationType() {
47+
return AdjustPeriodicEventStreamResponse.class;
48+
}
49+
50+
@Override
51+
public String getAction() {
52+
return "AdjustPeriodicEventStream";
53+
}
54+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
ChargeTime.eu - Java-OCA-OCPP
3+
4+
MIT License
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in all
14+
copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
SOFTWARE.
23+
*/
24+
25+
package eu.chargetime.ocpp.v21.feature;
26+
27+
import eu.chargetime.ocpp.feature.FunctionFeature;
28+
import eu.chargetime.ocpp.feature.function.Function;
29+
import eu.chargetime.ocpp.model.Confirmation;
30+
import eu.chargetime.ocpp.model.Request;
31+
import eu.chargetime.ocpp.v21.model.messages.AuthorizeRequest;
32+
import eu.chargetime.ocpp.v21.model.messages.AuthorizeResponse;
33+
34+
public class AuthorizeFeature extends FunctionFeature {
35+
36+
public AuthorizeFeature(Function ownerFunction) {
37+
super(ownerFunction);
38+
}
39+
40+
@Override
41+
public Class<? extends Request> getRequestType() {
42+
return AuthorizeRequest.class;
43+
}
44+
45+
@Override
46+
public Class<? extends Confirmation> getConfirmationType() {
47+
return AuthorizeResponse.class;
48+
}
49+
50+
@Override
51+
public String getAction() {
52+
return "Authorize";
53+
}
54+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
ChargeTime.eu - Java-OCA-OCPP
3+
4+
MIT License
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in all
14+
copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
SOFTWARE.
23+
*/
24+
25+
package eu.chargetime.ocpp.v21.feature;
26+
27+
import eu.chargetime.ocpp.feature.FunctionFeature;
28+
import eu.chargetime.ocpp.feature.function.Function;
29+
import eu.chargetime.ocpp.model.Confirmation;
30+
import eu.chargetime.ocpp.model.Request;
31+
import eu.chargetime.ocpp.v21.model.messages.BatterySwapRequest;
32+
import eu.chargetime.ocpp.v21.model.messages.BatterySwapResponse;
33+
34+
public class BatterySwapFeature extends FunctionFeature {
35+
36+
public BatterySwapFeature(Function ownerFunction) {
37+
super(ownerFunction);
38+
}
39+
40+
@Override
41+
public Class<? extends Request> getRequestType() {
42+
return BatterySwapRequest.class;
43+
}
44+
45+
@Override
46+
public Class<? extends Confirmation> getConfirmationType() {
47+
return BatterySwapResponse.class;
48+
}
49+
50+
@Override
51+
public String getAction() {
52+
return "BatterySwap";
53+
}
54+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
ChargeTime.eu - Java-OCA-OCPP
3+
4+
MIT License
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in all
14+
copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
SOFTWARE.
23+
*/
24+
25+
package eu.chargetime.ocpp.v21.feature;
26+
27+
import eu.chargetime.ocpp.feature.FunctionFeature;
28+
import eu.chargetime.ocpp.feature.function.Function;
29+
import eu.chargetime.ocpp.model.Confirmation;
30+
import eu.chargetime.ocpp.model.Request;
31+
import eu.chargetime.ocpp.v21.model.messages.BootNotificationRequest;
32+
import eu.chargetime.ocpp.v21.model.messages.BootNotificationResponse;
33+
34+
public class BootNotificationFeature extends FunctionFeature {
35+
36+
public BootNotificationFeature(Function ownerFunction) {
37+
super(ownerFunction);
38+
}
39+
40+
@Override
41+
public Class<? extends Request> getRequestType() {
42+
return BootNotificationRequest.class;
43+
}
44+
45+
@Override
46+
public Class<? extends Confirmation> getConfirmationType() {
47+
return BootNotificationResponse.class;
48+
}
49+
50+
@Override
51+
public String getAction() {
52+
return "BootNotification";
53+
}
54+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
ChargeTime.eu - Java-OCA-OCPP
3+
4+
MIT License
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in all
14+
copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
SOFTWARE.
23+
*/
24+
25+
package eu.chargetime.ocpp.v21.feature;
26+
27+
import eu.chargetime.ocpp.feature.FunctionFeature;
28+
import eu.chargetime.ocpp.feature.function.Function;
29+
import eu.chargetime.ocpp.model.Confirmation;
30+
import eu.chargetime.ocpp.model.Request;
31+
import eu.chargetime.ocpp.v21.model.messages.CancelReservationRequest;
32+
import eu.chargetime.ocpp.v21.model.messages.CancelReservationResponse;
33+
34+
public class CancelReservationFeature extends FunctionFeature {
35+
36+
public CancelReservationFeature(Function ownerFunction) {
37+
super(ownerFunction);
38+
}
39+
40+
@Override
41+
public Class<? extends Request> getRequestType() {
42+
return CancelReservationRequest.class;
43+
}
44+
45+
@Override
46+
public Class<? extends Confirmation> getConfirmationType() {
47+
return CancelReservationResponse.class;
48+
}
49+
50+
@Override
51+
public String getAction() {
52+
return "CancelReservation";
53+
}
54+
}

0 commit comments

Comments
 (0)