use of org.openmuc.openiec61850.ClientAssociation in project Protocol-Adapter-IEC61850 by OSGP.
the class Iec61850DeviceConnectionService method readNodeDataValues.
public void readNodeDataValues(final String deviceIdentification, final FcModelNode fcModelNode) throws NodeReadException {
final Iec61850Connection iec61850Connection = this.fetchIec61850Connection(deviceIdentification);
if (iec61850Connection == null) {
return;
}
final ClientAssociation clientAssociation = iec61850Connection.getClientAssociation();
this.iec61850Client.readNodeDataValues(clientAssociation, fcModelNode);
}
use of org.openmuc.openiec61850.ClientAssociation in project Protocol-Adapter-IEC61850 by OSGP.
the class Iec61850DeviceConnectionService method readServerModel.
private ServerModel readServerModel(final ClientAssociation clientAssociation, final String deviceIdentification, final Iec61850Device iec61850Device) throws ProtocolAdapterException {
ServerModel serverModel;
try {
serverModel = this.readServerModelConfiguredForDevice(clientAssociation, deviceIdentification, iec61850Device);
if (serverModel != null) {
return serverModel;
}
} catch (final ProtocolAdapterException e) {
LOGGER.warn("Ignore exception reading server model based on per device configuration for device: {}.", deviceIdentification, e);
}
try {
serverModel = this.readServerModelFromConfiguredIcdFile(clientAssociation);
if (serverModel != null) {
return serverModel;
}
} catch (final ProtocolAdapterException e) {
LOGGER.warn("Ignore exception reading server model based on configured ICD file.", e);
}
LOGGER.info("Reading ServerModel from device: {} using readServerModelFromDevice()", deviceIdentification);
return this.iec61850Client.readServerModelFromDevice(clientAssociation);
}
use of org.openmuc.openiec61850.ClientAssociation in project Protocol-Adapter-IEC61850 by OSGP.
the class Iec61850RtuDeviceService method setData.
@Override
public void setData(final SetDataDeviceRequest deviceRequest, final DeviceResponseHandler deviceResponseHandler) throws JMSException {
try {
final String serverName = this.getServerName(deviceRequest);
final ServerModel serverModel = this.connectAndRetrieveServerModel(deviceRequest, serverName);
final ClientAssociation clientAssociation = this.iec61850DeviceConnectionService.getClientAssociation(deviceRequest.getDeviceIdentification());
this.handleSetData(new DeviceConnection(new Iec61850Connection(new Iec61850ClientAssociation(clientAssociation, null), serverModel), deviceRequest.getDeviceIdentification(), deviceRequest.getOrganisationIdentification(), serverName), deviceRequest);
final EmptyDeviceResponse deviceResponse = new EmptyDeviceResponse(deviceRequest.getOrganisationIdentification(), deviceRequest.getDeviceIdentification(), deviceRequest.getCorrelationUid(), DeviceMessageStatus.OK);
deviceResponseHandler.handleResponse(deviceResponse);
} catch (final ConnectionFailureException se) {
LOGGER.error("Could not connect to device after all retries", se);
final EmptyDeviceResponse deviceResponse = new EmptyDeviceResponse(deviceRequest.getOrganisationIdentification(), deviceRequest.getDeviceIdentification(), deviceRequest.getCorrelationUid(), DeviceMessageStatus.FAILURE);
deviceResponseHandler.handleConnectionFailure(se, deviceResponse);
} catch (final Exception e) {
LOGGER.error("Unexpected exception during Set Data", e);
final EmptyDeviceResponse deviceResponse = new EmptyDeviceResponse(deviceRequest.getOrganisationIdentification(), deviceRequest.getDeviceIdentification(), deviceRequest.getCorrelationUid(), DeviceMessageStatus.FAILURE);
deviceResponseHandler.handleException(e, deviceResponse);
}
}
use of org.openmuc.openiec61850.ClientAssociation in project Protocol-Adapter-IEC61850 by OSGP.
the class Iec61850RtuDeviceService method getData.
@Override
public void getData(final GetDataDeviceRequest deviceRequest, final DeviceResponseHandler deviceResponseHandler) 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 GetDataResponseDto getDataResponse = this.handleGetData(new DeviceConnection(new Iec61850Connection(new Iec61850ClientAssociation(clientAssociation, null), serverModel), deviceRequest.getDeviceIdentification(), deviceRequest.getOrganisationIdentification(), serverName), deviceRequest);
final GetDataDeviceResponse deviceResponse = new GetDataDeviceResponse(deviceRequest.getOrganisationIdentification(), deviceRequest.getDeviceIdentification(), deviceRequest.getCorrelationUid(), DeviceMessageStatus.OK, getDataResponse);
deviceResponseHandler.handleResponse(deviceResponse);
} catch (final ConnectionFailureException se) {
LOGGER.error("Could not connect to device after all retries", se);
final EmptyDeviceResponse deviceResponse = new EmptyDeviceResponse(deviceRequest.getOrganisationIdentification(), deviceRequest.getDeviceIdentification(), deviceRequest.getCorrelationUid(), DeviceMessageStatus.FAILURE);
deviceResponseHandler.handleConnectionFailure(se, deviceResponse);
} catch (final Exception e) {
LOGGER.error("Unexpected exception during Get Data", e);
final EmptyDeviceResponse deviceResponse = new EmptyDeviceResponse(deviceRequest.getOrganisationIdentification(), deviceRequest.getDeviceIdentification(), deviceRequest.getCorrelationUid(), DeviceMessageStatus.FAILURE);
deviceResponseHandler.handleException(e, deviceResponse);
}
}
use of org.openmuc.openiec61850.ClientAssociation in project Protocol-Adapter-IEC61850 by OSGP.
the class Iec61850DeviceConnectionService method readAllValues.
public void readAllValues(final String deviceIdentification) throws NodeReadException {
final Iec61850Connection iec61850Connection = this.fetchIec61850Connection(deviceIdentification);
if (iec61850Connection == null) {
return;
}
final ClientAssociation clientAssociation = iec61850Connection.getClientAssociation();
this.iec61850Client.readAllDataValues(clientAssociation);
}
Aggregations