use of org.opensmartgridplatform.adapter.protocol.iec61850.device.DeviceRequest in project open-smart-grid-platform by OSGP.
the class Iec61850DaRtuDeviceService method getData.
@Override
public void getData(final DaDeviceRequest deviceRequest, final DeviceResponseHandler deviceResponseHandler, final DaRtuDeviceRequestMessageProcessor messageProcessor) throws JMSException {
try {
final String serverName = this.getServerName(deviceRequest);
final ServerModel serverModel = this.connectAndRetrieveServerModel(deviceRequest, serverName);
final ClientAssociation clientAssociation = this.iec61850DeviceConnectionService.getClientAssociation(deviceRequest.getDeviceIdentification());
final Serializable dataResponse = this.handleGetData(new DeviceConnection(new Iec61850Connection(new Iec61850ClientAssociation(clientAssociation, null), serverModel), deviceRequest.getDeviceIdentification(), deviceRequest.getOrganisationIdentification(), serverName), deviceRequest, messageProcessor);
final DaDeviceResponse deviceResponse = new DaDeviceResponse(deviceRequest, DeviceMessageStatus.OK, dataResponse);
deviceResponseHandler.handleResponse(deviceResponse);
} catch (final ConnectionFailureException se) {
LOGGER.error("Could not connect to device after all retries", se);
final EmptyDeviceResponse deviceResponse = new EmptyDeviceResponse(deviceRequest, DeviceMessageStatus.FAILURE);
deviceResponseHandler.handleConnectionFailure(se, deviceResponse);
} catch (final Exception e) {
LOGGER.error("Unexpected exception during Get Data", e);
final EmptyDeviceResponse deviceResponse = new EmptyDeviceResponse(deviceRequest, DeviceMessageStatus.FAILURE);
deviceResponseHandler.handleException(e, deviceResponse);
}
}
use of org.opensmartgridplatform.adapter.protocol.iec61850.device.DeviceRequest in project open-smart-grid-platform by OSGP.
the class PublicLightingGetLightSensorStatusRequestMessageProcessor method processMessage.
/*
* (non-Javadoc)
*
* @see org.opensmartgridplatform.shared.infra.jms.MessageProcessor#
* processMessage(javax .jms.ObjectMessage)
*/
@Override
public void processMessage(final ObjectMessage message) throws JMSException {
LOGGER.debug("Processing public lighting get status request message");
final MessageMetadata messageMetadata;
try {
messageMetadata = MessageMetadata.fromMessage(message);
} catch (final JMSException e) {
LOGGER.error("UNRECOVERABLE ERROR, unable to read ObjectMessage instance, giving up.", e);
return;
}
final String messageType = messageMetadata.getMessageType();
final RequestMessageData requestMessageData = RequestMessageData.newBuilder().messageMetadata(messageMetadata).messageType(messageType).build();
this.printDomainInfo(requestMessageData);
final Iec61850DeviceResponseHandler iec61850DeviceResponseHandler = this.createIec61850DeviceResponseHandler(requestMessageData, message);
final DeviceRequest deviceRequest = DeviceRequest.newBuilder().messageMetaData(messageMetadata).messageType(messageType).build();
this.deviceService.getLightSensorStatus(deviceRequest, iec61850DeviceResponseHandler);
}
use of org.opensmartgridplatform.adapter.protocol.iec61850.device.DeviceRequest in project open-smart-grid-platform by OSGP.
the class CommonGetConfigurationRequestMessageProcessor method processMessage.
@Override
public void processMessage(final ObjectMessage message) throws JMSException {
LOGGER.debug("Processing common get configuration message");
final MessageMetadata messageMetadata;
try {
messageMetadata = MessageMetadata.fromMessage(message);
} catch (final JMSException e) {
LOGGER.error("UNRECOVERABLE ERROR, unable to read ObjectMessage instance, giving up.", e);
return;
}
final RequestMessageData requestMessageData = RequestMessageData.newBuilder().messageMetadata(messageMetadata).build();
this.printDomainInfo(requestMessageData);
final Iec61850DeviceResponseHandler iec61850DeviceResponseHandler = this.createIec61850DeviceResponseHandler(requestMessageData, message);
final DeviceRequest deviceRequest = DeviceRequest.newBuilder().messageMetaData(messageMetadata).build();
this.deviceService.getConfiguration(deviceRequest, iec61850DeviceResponseHandler);
}
use of org.opensmartgridplatform.adapter.protocol.iec61850.device.DeviceRequest in project open-smart-grid-platform by OSGP.
the class CommonGetFirmwareRequestMessageProcessor method processMessage.
@Override
public void processMessage(final ObjectMessage message) throws JMSException {
LOGGER.debug("Processing common get firmware request message");
final MessageMetadata messageMetadata;
try {
messageMetadata = MessageMetadata.fromMessage(message);
} catch (final JMSException e) {
LOGGER.error("UNRECOVERABLE ERROR, unable to read ObjectMessage instance, giving up.", e);
return;
}
final RequestMessageData requestMessageData = RequestMessageData.newBuilder().messageMetadata(messageMetadata).build();
this.printDomainInfo(requestMessageData);
final Iec61850DeviceResponseHandler iec61850DeviceResponseHandler = this.createIec61850DeviceResponseHandler(requestMessageData, message);
final DeviceRequest deviceRequest = DeviceRequest.newBuilder().messageMetaData(messageMetadata).build();
this.deviceService.getFirmwareVersion(deviceRequest, iec61850DeviceResponseHandler);
}
use of org.opensmartgridplatform.adapter.protocol.iec61850.device.DeviceRequest in project open-smart-grid-platform by OSGP.
the class CommonStopDeviceTestRequestMessageProcessor method processMessage.
@Override
public void processMessage(final ObjectMessage message) throws JMSException {
LOGGER.debug("Processing common stop device test request message");
MessageMetadata messageMetadata;
try {
messageMetadata = MessageMetadata.fromMessage(message);
} catch (final JMSException e) {
LOGGER.error("UNRECOVERABLE ERROR, unable to read ObjectMessage instance, giving up.", e);
return;
}
final RequestMessageData requestMessageData = RequestMessageData.newBuilder().messageMetadata(messageMetadata).build();
this.printDomainInfo(requestMessageData);
final Iec61850DeviceResponseHandler iec61850DeviceResponseHandler = this.createIec61850DeviceResponseHandler(requestMessageData, message);
final DeviceRequest deviceRequest = DeviceRequest.newBuilder().messageMetaData(messageMetadata).build();
// This is a stop self-test, so startOfTest == false.
this.deviceService.runSelfTest(deviceRequest, iec61850DeviceResponseHandler, false);
}
Aggregations