Skip to content

Commit a37f3c2

Browse files
committed
Started java docs for v1_6
1 parent d8d0b0a commit a37f3c2

File tree

5 files changed

+230
-9
lines changed

5 files changed

+230
-9
lines changed

ocpp-v1_6/src/main/java/eu/chargetime/ocpp/JSONClient.java

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@
22

33
import eu.chargetime.ocpp.feature.profile.CoreProfile;
44

5-
/**
5+
/*
66
* ChargeTime.eu - Java-OCA-OCPP
7-
* <p>
7+
*
88
* MIT License
9-
* <p>
9+
*
1010
* Copyright (C) 2016 Thomas Volden <[email protected]>
11-
* <p>
11+
*
1212
* Permission is hereby granted, free of charge, to any person obtaining a copy
1313
* of this software and associated documentation files (the "Software"), to deal
1414
* in the Software without restriction, including without limitation the rights
1515
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1616
* copies of the Software, and to permit persons to whom the Software is
1717
* furnished to do so, subject to the following conditions:
18-
* <p>
18+
*
1919
* The above copyright notice and this permission notice shall be included in all
2020
* copies or substantial portions of the Software.
21-
* <p>
21+
*
2222
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2323
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2424
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -27,8 +27,17 @@
2727
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2828
* SOFTWARE.
2929
*/
30+
31+
/**
32+
* OCA OCPP version 1.6 JSON Web Socket implementation of the client.
33+
*/
3034
public class JSONClient extends Client {
3135

36+
/**
37+
* The core feature profile is required as a minimum.
38+
*
39+
* @param coreProfile implementation of the core feature profile.
40+
*/
3241
public JSONClient(CoreProfile coreProfile) {
3342
super(new Session(new JSONCommunicator(new WebSocketTransmitter()), new Queue()));
3443
addFeatureProfile(coreProfile);

ocpp-v1_6/src/main/java/eu/chargetime/ocpp/JSONCommunicator.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import java.lang.reflect.Type;
1313
import java.util.Calendar;
1414

15-
/**
15+
/*
1616
ChargeTime.eu - Java-OCA-OCPP
1717
Copyright (C) 2015-2016 Thomas Volden <[email protected]>
1818
@@ -38,6 +38,10 @@ of this software and associated documentation files (the "Software"), to deal
3838
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3939
SOFTWARE.
4040
*/
41+
42+
/**
43+
* Communicator for JSON messages
44+
*/
4145
public class JSONCommunicator extends Communicator {
4246

4347
private static final int INDEX_MESSAGEID = 0;
@@ -47,10 +51,16 @@ public class JSONCommunicator extends Communicator {
4751
private static final int TYPENUMBER_CALLRESULT = 3;
4852
private static final int INDEX_CALLRESULT_PAYLOAD = 2;
4953
private static final int INDEX_UNIQUEID = 1;
54+
5055
private static final String CALL_FORMAT = "[2,\"%s\",\"%s\",%s]";
5156
private static final String CALLRESULT_FORMAT = "[3,\"%s\",%s]";
5257
private static final String CALLERROR_FORMAT = "[4,\"%s\",\"%s\",\"%s\",%s]";
5358

59+
/**
60+
* Handle required injections.
61+
*
62+
* @param transmitter instance of the {@link Transmitter}.
63+
*/
5464
public JSONCommunicator(Transmitter transmitter) {
5565
super(transmitter);
5666
}

ocpp-v1_6/src/main/java/eu/chargetime/ocpp/WebSocketTransmitter.java

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,36 @@
55

66
import java.net.URI;
77

8+
/*
9+
ChargeTime.eu - Java-OCA-OCPP
10+
Copyright (C) 2015-2016 Thomas Volden <[email protected]>
11+
12+
MIT License
13+
14+
Copyright (c) 2016 Thomas Volden
15+
16+
Permission is hereby granted, free of charge, to any person obtaining a copy
17+
of this software and associated documentation files (the "Software"), to deal
18+
in the Software without restriction, including without limitation the rights
19+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
20+
copies of the Software, and to permit persons to whom the Software is
21+
furnished to do so, subject to the following conditions:
22+
23+
The above copyright notice and this permission notice shall be included in all
24+
copies or substantial portions of the Software.
25+
26+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
27+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
28+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
29+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
30+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
31+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32+
SOFTWARE.
33+
*/
34+
35+
/**
36+
* Web Socket implementation of the Transmitter.
37+
*/
838
public class WebSocketTransmitter implements Transmitter
939
{
1040
private WebSocketClient client;

ocpp-v1_6/src/main/java/eu/chargetime/ocpp/feature/profile/ClientCoreEventHandler.java

Lines changed: 66 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import eu.chargetime.ocpp.model.*;
44

5-
/**
5+
/*
66
ChargeTime.eu - Java-OCA-OCPP
77
Copyright (C) 2015-2016 Thomas Volden <[email protected]>
88
@@ -28,15 +28,80 @@ of this software and associated documentation files (the "Software"), to deal
2828
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2929
SOFTWARE.
3030
*/
31+
32+
/**
33+
* Call back handler for client events of the core feature profile.
34+
*/
3135
public interface ClientCoreEventHandler {
36+
/**
37+
* Handle a {@link ChangeAvailabilityRequest} and return a {@link ChangeAvailabilityConfirmation}.
38+
*
39+
* @param request incoming {@link ChangeAvailabilityRequest} to handle.
40+
* @return outgoing {@link ChangeAvailabilityConfirmation} to reply with.
41+
*/
3242
ChangeAvailabilityConfirmation handleChangeAvailabilityRequest(ChangeAvailabilityRequest request);
43+
44+
/**
45+
* Handle a {@link GetConfigurationRequest} and return a {@link GetConfigurationConfirmation}.
46+
*
47+
* @param request incoming {@link GetConfigurationRequest} to handle.
48+
* @return outgoing {@link GetConfigurationConfirmation} to reply with.
49+
*/
3350
GetConfigurationConfirmation handleGetConfigurationRequest(GetConfigurationRequest request);
51+
52+
/**
53+
* Handle a {@link ChangeConfigurationRequest} and return a {@link ChangeConfigurationConfirmation}.
54+
*
55+
* @param request incoming {@link ChangeConfigurationRequest} to handle.
56+
* @return outgoing {@link ChangeConfigurationConfirmation} to reply with.
57+
*/
3458
ChangeConfigurationConfirmation handleChangeConfigurationRequest(ChangeConfigurationRequest request);
59+
60+
/**
61+
* Handle a {@link ClearCacheRequest} and return a {@link ClearCacheConfirmation}.
62+
*
63+
* @param request incoming {@link ClearCacheRequest} to handle.
64+
* @return outgoing {@link ClearCacheConfirmation} to reply with.
65+
*/
3566
ClearCacheConfirmation handleClearCacheRequest(ClearCacheRequest request);
67+
68+
/**
69+
* Handle a {@link DataTransferRequest} and return a {@link DataTransferConfirmation}.
70+
*
71+
* @param request incoming {@link DataTransferRequest} to handle.
72+
* @return outgoing {@link DataTransferConfirmation} to reply with.
73+
*/
3674
DataTransferConfirmation handleDataTransferRequest(DataTransferRequest request);
75+
76+
/**
77+
* Handle a {@link RemoteStartTransactionRequest} and return a {@link RemoteStartTransactionConfirmation}.
78+
*
79+
* @param request incoming {@link RemoteStartTransactionRequest} to handle.
80+
* @return outgoing {@link RemoteStartTransactionConfirmation} to reply with.
81+
*/
3782
RemoteStartTransactionConfirmation handleRemoteStartTransactionRequest(RemoteStartTransactionRequest request);
83+
84+
/**
85+
* Handle a {@link RemoteStopTransactionRequest} and return a {@link RemoteStopTransactionConfirmation}.
86+
*
87+
* @param request incoming {@link RemoteStopTransactionRequest} to handle.
88+
* @return outgoing {@link RemoteStopTransactionConfirmation} to reply with.
89+
*/
3890
RemoteStopTransactionConfirmation handleRemoteStopTransactionRequest(RemoteStopTransactionRequest request);
91+
92+
/**
93+
* Handle a {@link ResetRequest} and return a {@link ResetConfirmation}.
94+
*
95+
* @param request incoming {@link ResetRequest} to handle.
96+
* @return outgoing {@link ResetConfirmation} to reply with.
97+
*/
3998
ResetConfirmation handleResetRequest(ResetRequest request);
4099

100+
/**
101+
* Handle a {@link UnlockConnectorRequest} and return a {@link UnlockConnectorConfirmation}.
102+
*
103+
* @param request incoming {@link UnlockConnectorRequest} to handle.
104+
* @return outgoing {@link UnlockConnectorConfirmation} to reply with.
105+
*/
41106
UnlockConnectorConfirmation handleUnlockConnectorRequest(UnlockConnectorRequest request);
42107
}

ocpp-v1_6/src/main/java/eu/chargetime/ocpp/feature/profile/CoreProfile.java

Lines changed: 108 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import java.util.ArrayList;
88
import java.util.Calendar;
99

10-
/**
10+
/*
1111
ChargeTime.eu - Java-OCA-OCPP
1212
Copyright (C) 2015-2016 Thomas Volden <[email protected]>
1313
@@ -33,11 +33,22 @@ of this software and associated documentation files (the "Software"), to deal
3333
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3434
SOFTWARE.
3535
*/
36+
37+
/**
38+
* The core feature profile contains the features from OCPP v. 1.5
39+
* <p>
40+
* Contains methods to create outgoing client requests.
41+
*/
3642
public class CoreProfile implements Profile
3743
{
3844
ClientCoreEventHandler eventHandler;
3945
ArrayList<Feature> features;
4046

47+
/**
48+
* Set up handler for client core feature requests.
49+
50+
* @param handler call back methods for client events
51+
*/
4152
public CoreProfile(ClientCoreEventHandler handler) {
4253
features = new ArrayList<>();
4354
eventHandler = handler;
@@ -60,42 +71,119 @@ public CoreProfile(ClientCoreEventHandler handler) {
6071
features.add(new UnlockConnectorFeature(this));
6172
}
6273

74+
/**
75+
* Create a client {@link AuthorizeRequest} with required values.
76+
*
77+
* @param idToken required identification token.
78+
* @return an instance of {@link AuthorizeRequest}.
79+
* @throws PropertyConstraintException cast if requires fields isn't filled out correctly.
80+
* @see AuthorizeRequest
81+
* @see AuthorizeFeature
82+
*/
6383
public AuthorizeRequest createAuthorizeRequest(String idToken) throws PropertyConstraintException {
6484
return new AuthorizeRequest(idToken);
6585
}
6686

87+
/**
88+
* Create a client {@link BootNotificationRequest} with required values.
89+
*
90+
* @param vendor required. Vendor name.
91+
* @param model required. Charge box model.
92+
* @return an instance of {@link BootNotificationRequest}
93+
* @see BootNotificationRequest
94+
* @see BootNotificationFeature
95+
*/
6796
public BootNotificationRequest createBootNotificationRequest(String vendor, String model) {
6897
return new BootNotificationRequest(vendor, model);
6998
}
7099

100+
/**
101+
* Create a client {@link DataTransferRequest} with required values.
102+
*
103+
* @param vendorId required. Vendor identification.
104+
* @return an instance of {@link DataTransferRequest}.
105+
* @see DataTransferRequest
106+
* @see DataTransferFeature
107+
*/
71108
public DataTransferRequest createDataTransferRequest(String vendorId) {
72109
return new DataTransferRequest(vendorId);
73110
}
74111

112+
/**
113+
* Create a client {@link HeartbeatRequest}.
114+
*
115+
* @return an instance of {@link HeartbeatRequest}
116+
* @see HeartbeatRequest
117+
* @see HeartbeatFeature
118+
*/
75119
public HeartbeatRequest createHeartbeatRequest() {
76120
return new HeartbeatRequest();
77121
}
78122

123+
/**
124+
* Create a client {@link MeterValuesRequest} with one {@link SampledValue} and one {@link MeterValue}
125+
*
126+
* @param connectorId required. Identification of connector.
127+
* @param timestamp required. Time of sample.
128+
* @param value required. Value of sample.
129+
* @return an instance of {@link MeterValuesRequest}.
130+
* @throws PropertyConstraintException thrown if a required field isn't filled out correctly.
131+
* @see MeterValuesRequest
132+
* @see MeterValuesFeature
133+
*/
79134
public MeterValuesRequest createMeterValuesRequest(Integer connectorId, Calendar timestamp, String value) throws PropertyConstraintException {
80135
SampledValue sampledValue = new SampledValue();
81136
sampledValue.setValue(value);
82137
return createMeterValuesRequest(connectorId, timestamp, sampledValue);
83138
}
84139

140+
/**
141+
* Create a client {@link MeterValuesRequest} with some {@link SampledValue}s and one {@link MeterValue}.
142+
*
143+
* @param connectorId required. Identification of connector.
144+
* @param timestamp required. Time of sample.
145+
* @param sampledValues required. Params list of {@link SampledValue}s
146+
* @return an instance of {@link MeterValuesRequest}
147+
* @throws PropertyConstraintException thrown if a required field isn't filled out correctly.
148+
* @see MeterValuesRequest
149+
* @see MeterValuesFeature
150+
*/
85151
public MeterValuesRequest createMeterValuesRequest(Integer connectorId, Calendar timestamp, SampledValue... sampledValues) throws PropertyConstraintException {
86152
MeterValue meterValue = new MeterValue();
87153
meterValue.setTimestamp(timestamp);
88154
meterValue.setSampledValue(sampledValues);
89155
return createMeterValuesRequest(connectorId, meterValue);
90156
}
91157

158+
/**
159+
* Create a client {@link MeterValuesRequest} with some {@link MeterValue}s.
160+
*
161+
* @param connectorId required. Identification of connector.
162+
* @param meterValues required. Params list of {@link MeterValue}s
163+
* @return an instance of {@link MeterValuesRequest}
164+
* @throws PropertyConstraintException thrown if a required field isn't filled out correctly.
165+
* @see MeterValuesRequest
166+
* @see MeterValuesFeature
167+
*/
92168
public MeterValuesRequest createMeterValuesRequest(Integer connectorId, MeterValue... meterValues) throws PropertyConstraintException {
93169
MeterValuesRequest request = new MeterValuesRequest();
94170
request.setConnectorId(connectorId);
95171
request.setMeterValue(meterValues);
96172
return request;
97173
}
98174

175+
/**
176+
* Create a client {@link StartTransactionRequest} with required values.
177+
*
178+
* @param connectorId required. Identification of the connector.
179+
* @param idTag required. Authorization identification tag.
180+
* @param meterStart required. The initial value of the meter.
181+
* @param timestamp required. Time of start.
182+
* @return an instance of {@link StartTransactionRequest}.
183+
* @throws PropertyConstraintException thrown if a required field isn't filled out correctly.
184+
* @see StartTransactionRequest
185+
* @see StartTransactionFeature
186+
*/
99187
public StartTransactionRequest createStartTransactionRequest(Integer connectorId, String idTag, Integer meterStart, Calendar timestamp) throws PropertyConstraintException {
100188
StartTransactionRequest request = new StartTransactionRequest();
101189
request.setConnectorId(connectorId);
@@ -107,6 +195,17 @@ public StartTransactionRequest createStartTransactionRequest(Integer connectorId
107195
return request;
108196
}
109197

198+
/**
199+
* Create a client {@link StatusNotificationRequest} with required values.
200+
*
201+
* @param connectorId required. Identification of the connector.
202+
* @param errorCode required. {@link ChargePointErrorCode} of the connector.
203+
* @param status required. {@link ChargePointStatus} of the connector.
204+
* @return an instance of {@link StatusNotificationRequest}.
205+
* @throws PropertyConstraintException thrown if a required field isn't filled out correctly.
206+
* @see StatusNotificationRequest
207+
* @see StatusNotificationFeature
208+
*/
110209
public StatusNotificationRequest createStatusNotificationRequest(Integer connectorId, ChargePointErrorCode errorCode, ChargePointStatus status) throws PropertyConstraintException {
111210
StatusNotificationRequest request = new StatusNotificationRequest();
112211
request.setConnectorId(connectorId);
@@ -115,6 +214,14 @@ public StatusNotificationRequest createStatusNotificationRequest(Integer connect
115214
return request;
116215
}
117216

217+
/**
218+
* Create a client {@link StopTransactionRequest} with required values.
219+
*
220+
* @param meterStop required. The final value of the meter.
221+
* @param timestamp required. Time of stop.
222+
* @param transactionId required. The identification of the transaction.
223+
* @return an instance of {@link StopTransactionRequest}.
224+
*/
118225
public StopTransactionRequest createStopTransactionRequest(int meterStop, Calendar timestamp, int transactionId) {
119226
StopTransactionRequest request = new StopTransactionRequest();
120227
request.setMeterStop(meterStop);

0 commit comments

Comments
 (0)