use of org.opensmartgridplatform.adapter.protocol.dlms.exceptions.ProtocolAdapterException in project open-smart-grid-platform by OSGP.
the class SetPushSetupAlarmCommandExecutor method setSendDestinationAndMethod.
private AccessResultCode setSendDestinationAndMethod(final DlmsConnectionManager conn, final PushSetupAlarmDto pushSetupAlarm) throws ProtocolAdapterException {
LOGGER.info("Setting Send destination and method of Push Setup Alarm: {}", pushSetupAlarm.getSendDestinationAndMethod());
final SetParameter setParameterSendDestinationAndMethod = this.getSetParameterSendDestinationAndMethod(pushSetupAlarm);
final AccessResultCode resultCode = this.doSetRequest("PushSetupAlarm, Send destination and method", conn, setParameterSendDestinationAndMethod);
if (resultCode != null) {
return resultCode;
} else {
throw new ProtocolAdapterException("Error setting Alarm push setup data (destination and method.");
}
}
use of org.opensmartgridplatform.adapter.protocol.dlms.exceptions.ProtocolAdapterException in project open-smart-grid-platform by OSGP.
the class SetPushSetupAlarmCommandExecutor method setPushObjectList.
private AccessResultCode setPushObjectList(final DlmsConnectionManager conn, final PushSetupAlarmDto pushSetupAlarm) throws ProtocolAdapterException {
LOGGER.info("Setting Push Object List of Push Setup Alarm: {}", pushSetupAlarm.getPushObjectList());
// Before setting the push object list, verify if the objects in the list are really present in
// the meter
this.verifyPushObjects(pushSetupAlarm.getPushObjectList(), conn);
final SetParameter setParameterPushObjectList = this.getSetParameterPushObjectList(pushSetupAlarm);
final AccessResultCode resultCode = this.doSetRequest("PushSetupAlarm, push object list", conn, setParameterPushObjectList);
if (resultCode != null) {
return resultCode;
} else {
throw new ProtocolAdapterException("Error setting Alarm push setup data (push object list).");
}
}
use of org.opensmartgridplatform.adapter.protocol.dlms.exceptions.ProtocolAdapterException in project open-smart-grid-platform by OSGP.
the class ImageTransfer method waitForImageInitiation.
private void waitForImageInitiation() throws OsgpException {
final Future<Integer> newStatus = EXECUTOR_SERVICE.submit(new ImageTransferStatusChangeWatcher(ImageTransferStatus.NOT_INITIATED, this.properties.getInitiationStatusCheckInterval(), this.properties.getInitiationStatusCheckTimeout()));
final int status;
try {
status = newStatus.get();
} catch (final InterruptedException | ExecutionException e) {
throw new ProtocolAdapterException("", e);
}
if (status != ImageTransferStatus.INITIATED.getValue()) {
throw new ImageTransferException(EXCEPTION_MSG_IMAGE_TRANSFER_NOT_INITIATED);
}
}
use of org.opensmartgridplatform.adapter.protocol.dlms.exceptions.ProtocolAdapterException in project open-smart-grid-platform by OSGP.
the class ImageTransfer method waitForImageVerification.
private void waitForImageVerification() throws OsgpException {
final Future<Integer> newStatus = EXECUTOR_SERVICE.submit(new ImageTransferStatusChangeWatcher(ImageTransferStatus.VERIFICATION_INITIATED, this.properties.getVerificationStatusCheckInterval(), this.properties.getVerificationStatusCheckTimeout()));
final int status;
try {
status = newStatus.get();
} catch (final InterruptedException | ExecutionException e) {
throw new ProtocolAdapterException("", e);
}
if (status == ImageTransferStatus.VERIFICATION_FAILED.getValue()) {
throw new ImageTransferException(EXCEPTION_MSG_IMAGE_NOT_VERIFIED);
}
}
use of org.opensmartgridplatform.adapter.protocol.dlms.exceptions.ProtocolAdapterException in project open-smart-grid-platform by OSGP.
the class ImageTransfer method getImageTransferStatus.
private int getImageTransferStatus() throws ProtocolAdapterException {
this.connector.getDlmsMessageListener().setDescription("ImageTransfer read image_transfer_status, read attribute: " + JdlmsObjectToStringUtil.describeAttributes(this.imageTransferCosem.createAttributeAddress(ImageTransferAttribute.IMAGE_TRANSFER_STATUS)));
final DataObject imageTransferStatusData = this.imageTransferCosem.readAttribute(ImageTransferAttribute.IMAGE_TRANSFER_STATUS);
if (imageTransferStatusData == null || !imageTransferStatusData.isNumber()) {
throw new ProtocolAdapterException(EXCEPTION_MSG_IMAGE_TRANSFER_STATUS_NOT_READ);
}
return (Integer) imageTransferStatusData.getValue();
}
Aggregations