use of com.alliander.osgp.adapter.protocol.iec61850.device.ssld.responses.GetStatusDeviceResponse in project Protocol-Adapter-IEC61850 by OSGP.
the class Iec61850SsldDeviceService method getStatus.
@Override
public void getStatus(final DeviceRequest deviceRequest, final DeviceResponseHandler deviceResponseHandler) throws JMSException {
DeviceConnection devCon = null;
try {
final DeviceConnection deviceConnection = this.connectToDevice(deviceRequest);
devCon = deviceConnection;
// Getting the SSLD for the device output-settings.
final Ssld ssld = this.ssldDataService.findDevice(deviceRequest.getDeviceIdentification());
final DeviceStatusDto deviceStatus = new Iec61850GetStatusCommand().getStatusFromDevice(this.iec61850Client, deviceConnection, ssld);
final GetStatusDeviceResponse deviceResponse = new GetStatusDeviceResponse(deviceRequest.getOrganisationIdentification(), deviceRequest.getDeviceIdentification(), deviceRequest.getCorrelationUid(), deviceStatus);
deviceResponseHandler.handleResponse(deviceResponse);
this.enableReporting(deviceConnection, deviceRequest);
} catch (final ConnectionFailureException se) {
this.handleConnectionFailureException(deviceRequest, deviceResponseHandler, se);
this.iec61850DeviceConnectionService.disconnect(devCon, deviceRequest);
} catch (final Exception e) {
this.handleException(deviceRequest, deviceResponseHandler, e);
this.iec61850DeviceConnectionService.disconnect(devCon, deviceRequest);
}
}
use of com.alliander.osgp.adapter.protocol.iec61850.device.ssld.responses.GetStatusDeviceResponse in project Protocol-Adapter-IEC61850 by OSGP.
the class SsldDeviceRequestMessageProcessor method handleGetStatusDeviceResponse.
// This function is used in 3 domains.
protected void handleGetStatusDeviceResponse(final DeviceResponse deviceResponse, final ResponseMessageSender responseMessageSender, final String domain, final String domainVersion, final String messageType, final int retryCount) {
LOGGER.info("Handling getStatusDeviceResponse for device: {}", deviceResponse.getDeviceIdentification());
if (StringUtils.isEmpty(deviceResponse.getCorrelationUid())) {
LOGGER.warn("CorrelationUID is null or empty, not sending GetStatusResponse message for GetStatusRequest message for device: {}", deviceResponse.getDeviceIdentification());
return;
}
final GetStatusDeviceResponse response = (GetStatusDeviceResponse) deviceResponse;
final DeviceStatusDto status = response.getDeviceStatus();
final DeviceMessageMetadata deviceMessageMetadata = new DeviceMessageMetadata(deviceResponse.getDeviceIdentification(), deviceResponse.getOrganisationIdentification(), deviceResponse.getCorrelationUid(), messageType, 0);
final ProtocolResponseMessage protocolResponseMessage = new ProtocolResponseMessage.Builder().domain(domain).domainVersion(domainVersion).deviceMessageMetadata(deviceMessageMetadata).result(ResponseMessageResultType.OK).osgpException(null).retryCount(retryCount).dataObject(status).build();
responseMessageSender.send(protocolResponseMessage);
}
Aggregations