use of ocpp.cs._2015._10.BootNotificationRequest in project steve by RWTH-i5-IDSG.
the class CentralSystemService16_Service method bootNotification.
public BootNotificationResponse bootNotification(BootNotificationRequest parameters, String chargeBoxIdentity, OcppProtocol ocppProtocol) {
DateTime now = DateTime.now();
UpdateChargeboxParams params = UpdateChargeboxParams.builder().ocppProtocol(ocppProtocol).vendor(parameters.getChargePointVendor()).model(parameters.getChargePointModel()).pointSerial(parameters.getChargePointSerialNumber()).boxSerial(parameters.getChargeBoxSerialNumber()).fwVersion(parameters.getFirmwareVersion()).iccid(parameters.getIccid()).imsi(parameters.getImsi()).meterType(parameters.getMeterType()).meterSerial(parameters.getMeterSerialNumber()).chargeBoxId(chargeBoxIdentity).heartbeatTimestamp(now).build();
boolean isRegistered = ocppServerRepository.updateChargebox(params);
notificationService.ocppStationBooted(chargeBoxIdentity, isRegistered);
RegistrationStatus status;
if (isRegistered) {
status = RegistrationStatus.ACCEPTED;
} else {
status = RegistrationStatus.REJECTED;
chargePointHelperService.rememberNewUnknown(chargeBoxIdentity);
}
return new BootNotificationResponse().withStatus(status).withCurrentTime(now).withInterval(settingsRepository.getHeartbeatIntervalInSeconds());
}
use of ocpp.cs._2015._10.BootNotificationRequest in project steve by RWTH-i5-IDSG.
the class ApplicationTest method testOcpp12.
@Test
public void testOcpp12() {
ocpp.cs._2010._08.CentralSystemService client = getForOcpp12();
BootNotificationResponse boot = client.bootNotification(new BootNotificationRequest().withChargePointVendor(getRandomString()).withChargePointModel(getRandomString()), REGISTERED_CHARGE_BOX_ID);
Assert.assertNotNull(boot);
Assert.assertEquals(RegistrationStatus.ACCEPTED, boot.getStatus());
AuthorizeResponse auth = client.authorize(new AuthorizeRequest().withIdTag(REGISTERED_OCPP_TAG), REGISTERED_CHARGE_BOX_ID);
Assert.assertNotNull(auth);
Assert.assertEquals(AuthorizationStatus.ACCEPTED, auth.getIdTagInfo().getStatus());
}
use of ocpp.cs._2015._10.BootNotificationRequest in project steve by RWTH-i5-IDSG.
the class ApplicationTest method testOcpp15.
@Test
public void testOcpp15() {
CentralSystemService client = getForOcpp15();
ocpp.cs._2012._06.BootNotificationResponse boot = client.bootNotification(new ocpp.cs._2012._06.BootNotificationRequest().withChargePointVendor(getRandomString()).withChargePointModel(getRandomString()), REGISTERED_CHARGE_BOX_ID);
Assert.assertNotNull(boot);
Assert.assertEquals(ocpp.cs._2012._06.RegistrationStatus.ACCEPTED, boot.getStatus());
ocpp.cs._2012._06.AuthorizeResponse auth = client.authorize(new ocpp.cs._2012._06.AuthorizeRequest().withIdTag(REGISTERED_OCPP_TAG), REGISTERED_CHARGE_BOX_ID);
Assert.assertNotNull(auth);
Assert.assertEquals(ocpp.cs._2012._06.AuthorizationStatus.ACCEPTED, auth.getIdTagInfo().getStatus());
}
use of ocpp.cs._2015._10.BootNotificationRequest in project steve by RWTH-i5-IDSG.
the class ApplicationJsonTest method testOcpp16.
@Test
public void testOcpp16() {
OcppJsonChargePoint chargePoint = new OcppJsonChargePoint(VERSION, REGISTERED_CHARGE_BOX_ID, PATH);
chargePoint.start();
BootNotificationRequest boot = new BootNotificationRequest().withChargePointVendor(getRandomString()).withChargePointModel(getRandomString());
chargePoint.prepare(boot, BootNotificationResponse.class, bootResponse -> Assert.assertEquals(RegistrationStatus.ACCEPTED, bootResponse.getStatus()), error -> Assert.fail());
AuthorizeRequest auth = new AuthorizeRequest().withIdTag(REGISTERED_OCPP_TAG);
chargePoint.prepare(auth, AuthorizeResponse.class, authResponse -> Assert.assertEquals(AuthorizationStatus.ACCEPTED, authResponse.getIdTagInfo().getStatus()), error -> Assert.fail());
chargePoint.processAndClose();
}
Aggregations