use of eu.chargetime.ocpp.ServerEvents in project Java-OCA-OCPP by ChargeTimeEU.
the class SOAPServerSample method started.
public void started() throws Exception {
if (server != null)
return;
// The core profile is mandatory
core = new ServerCoreProfile(new ServerCoreEventHandler() {
@Override
public AuthorizeConfirmation handleAuthorizeRequest(UUID sessionIndex, AuthorizeRequest request) {
System.out.println(request);
return new AuthorizeConfirmation();
}
@Override
public BootNotificationConfirmation handleBootNotificationRequest(UUID sessionIndex, BootNotificationRequest request) {
System.out.println(request);
// returning null means unsupported feature
return null;
}
@Override
public DataTransferConfirmation handleDataTransferRequest(UUID sessionIndex, DataTransferRequest request) {
System.out.println(request);
// returning null means unsupported feature
return null;
}
@Override
public HeartbeatConfirmation handleHeartbeatRequest(UUID sessionIndex, HeartbeatRequest request) {
System.out.println(request);
// returning null means unsupported feature
return null;
}
@Override
public MeterValuesConfirmation handleMeterValuesRequest(UUID sessionIndex, MeterValuesRequest request) {
System.out.println(request);
// returning null means unsupported feature
return null;
}
@Override
public StartTransactionConfirmation handleStartTransactionRequest(UUID sessionIndex, StartTransactionRequest request) {
System.out.println(request);
// returning null means unsupported feature
return null;
}
@Override
public StatusNotificationConfirmation handleStatusNotificationRequest(UUID sessionIndex, StatusNotificationRequest request) {
System.out.println(request);
// returning null means unsupported feature
return null;
}
@Override
public StopTransactionConfirmation handleStopTransactionRequest(UUID sessionIndex, StopTransactionRequest request) {
System.out.println(request);
// returning null means unsupported feature
return null;
}
});
server = new SOAPServer(core);
server.open("localhost", 8887, new ServerEvents() {
@Override
public void newSession(UUID sessionIndex, SessionInformation information) {
// sessionIndex is used to send messages.
System.out.println("New session " + sessionIndex + ": " + information.getIdentifier());
}
@Override
public void lostSession(UUID sessionIndex) {
System.out.println("Session " + sessionIndex + " lost connection");
}
});
}
use of eu.chargetime.ocpp.ServerEvents in project Java-OCA-OCPP by ChargeTimeEU.
the class JSONServerSample method started.
public void started() throws Exception {
if (server != null)
return;
// The core profile is mandatory
core = new ServerCoreProfile(new ServerCoreEventHandler() {
@Override
public AuthorizeConfirmation handleAuthorizeRequest(UUID sessionIndex, AuthorizeRequest request) {
System.out.println(request);
return new AuthorizeConfirmation();
}
@Override
public BootNotificationConfirmation handleBootNotificationRequest(UUID sessionIndex, BootNotificationRequest request) {
System.out.println(request);
// returning null means unsupported feature
return null;
}
@Override
public DataTransferConfirmation handleDataTransferRequest(UUID sessionIndex, DataTransferRequest request) {
System.out.println(request);
// returning null means unsupported feature
return null;
}
@Override
public HeartbeatConfirmation handleHeartbeatRequest(UUID sessionIndex, HeartbeatRequest request) {
System.out.println(request);
// returning null means unsupported feature
return null;
}
@Override
public MeterValuesConfirmation handleMeterValuesRequest(UUID sessionIndex, MeterValuesRequest request) {
System.out.println(request);
// returning null means unsupported feature
return null;
}
@Override
public StartTransactionConfirmation handleStartTransactionRequest(UUID sessionIndex, StartTransactionRequest request) {
System.out.println(request);
// returning null means unsupported feature
return null;
}
@Override
public StatusNotificationConfirmation handleStatusNotificationRequest(UUID sessionIndex, StatusNotificationRequest request) {
System.out.println(request);
// returning null means unsupported feature
return null;
}
@Override
public StopTransactionConfirmation handleStopTransactionRequest(UUID sessionIndex, StopTransactionRequest request) {
System.out.println(request);
// returning null means unsupported feature
return null;
}
});
server = new JSONServer(core);
server.open("localhost", 8887, new ServerEvents() {
@Override
public void newSession(UUID sessionIndex, SessionInformation information) {
// sessionIndex is used to send messages.
System.out.println("New session " + sessionIndex + ": " + information.getIdentifier());
}
@Override
public void lostSession(UUID sessionIndex) {
System.out.println("Session " + sessionIndex + " lost connection");
}
});
}
Aggregations