use of com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.DeviceConnection in project Protocol-Adapter-IEC61850 by OSGP.
the class Iec61850SsldDeviceService method setTransition.
@Override
public void setTransition(final SetTransitionDeviceRequest deviceRequest, final DeviceResponseHandler deviceResponseHandler) throws JMSException {
DeviceConnection devCon = null;
try {
final DeviceConnection deviceConnection = this.connectToDevice(deviceRequest);
devCon = deviceConnection;
new Iec61850TransitionCommand().transitionDevice(this.iec61850Client, deviceConnection, deviceRequest.getTransitionTypeContainer());
this.createSuccessfulDefaultResponse(deviceRequest, deviceResponseHandler);
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.infra.networking.helper.DeviceConnection in project Protocol-Adapter-IEC61850 by OSGP.
the class Iec61850SsldDeviceService method updateFirmware.
@Override
public void updateFirmware(final UpdateFirmwareDeviceRequest deviceRequest, final DeviceResponseHandler deviceResponseHandler) throws JMSException {
DeviceConnection deviceConnection = null;
try {
deviceConnection = this.connectToDevice(deviceRequest);
new Iec61850UpdateFirmwareCommand().pushFirmwareToDevice(this.iec61850Client, deviceConnection, deviceRequest.getFirmwareDomain().concat(deviceRequest.getFirmwareUrl()), deviceRequest.getFirmwareModuleData());
this.createSuccessfulDefaultResponse(deviceRequest, deviceResponseHandler);
} catch (final ConnectionFailureException se) {
this.handleConnectionFailureException(deviceRequest, deviceResponseHandler, se);
} catch (final Exception e) {
this.handleException(deviceRequest, deviceResponseHandler, e);
}
this.iec61850DeviceConnectionService.disconnect(deviceConnection, deviceRequest);
}
use of com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.DeviceConnection in project Protocol-Adapter-IEC61850 by OSGP.
the class Iec61850ActualPowerCommand method execute.
@Override
public MeasurementDto execute(final Iec61850Client client, final DeviceConnection connection, final LogicalDevice logicalDevice, final int logicalDeviceIndex) throws NodeReadException {
final NodeContainer containingNode = connection.getFcModelNode(logicalDevice, logicalDeviceIndex, LogicalNode.MEASUREMENT_ONE, DataAttribute.ACTUAL_POWER, Fc.MX);
client.readNodeDataValues(connection.getConnection().getClientAssociation(), containingNode.getFcmodelNode());
return this.translate(containingNode);
}
use of com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.DeviceConnection in project Protocol-Adapter-IEC61850 by OSGP.
the class Iec61850GetFirmwareVersionCommand method getFirmwareVersionFromDevice.
public List<FirmwareVersionDto> getFirmwareVersionFromDevice(final Iec61850Client iec61850Client, final DeviceConnection deviceConnection) throws ProtocolAdapterException {
final Function<List<FirmwareVersionDto>> function = new Function<List<FirmwareVersionDto>>() {
@Override
public List<FirmwareVersionDto> apply(final DeviceMessageLog deviceMessageLog) throws Exception {
final List<FirmwareVersionDto> output = new ArrayList<>();
// Getting the functional firmware version
LOGGER.info("Reading the functional firmware version");
final NodeContainer functionalFirmwareNode = deviceConnection.getFcModelNode(LogicalDevice.LIGHTING, LogicalNode.STREET_LIGHT_CONFIGURATION, DataAttribute.FUNCTIONAL_FIRMWARE, Fc.ST);
iec61850Client.readNodeDataValues(deviceConnection.getConnection().getClientAssociation(), functionalFirmwareNode.getFcmodelNode());
final String functionalFirmwareVersion = functionalFirmwareNode.getString(SubDataAttribute.CURRENT_VERSION);
// Adding it to the list
output.add(new FirmwareVersionDto(FirmwareModuleType.FUNCTIONAL, functionalFirmwareVersion));
deviceMessageLog.addVariable(LogicalNode.STREET_LIGHT_CONFIGURATION, DataAttribute.FUNCTIONAL_FIRMWARE, Fc.ST, SubDataAttribute.CURRENT_VERSION, functionalFirmwareVersion);
// Getting the security firmware version
LOGGER.info("Reading the security firmware version");
final NodeContainer securityFirmwareNode = deviceConnection.getFcModelNode(LogicalDevice.LIGHTING, LogicalNode.STREET_LIGHT_CONFIGURATION, DataAttribute.SECURITY_FIRMWARE, Fc.ST);
iec61850Client.readNodeDataValues(deviceConnection.getConnection().getClientAssociation(), securityFirmwareNode.getFcmodelNode());
final String securityFirmwareVersion = securityFirmwareNode.getString(SubDataAttribute.CURRENT_VERSION);
// Adding it to the list
output.add(new FirmwareVersionDto(FirmwareModuleType.SECURITY, securityFirmwareVersion));
deviceMessageLog.addVariable(LogicalNode.STREET_LIGHT_CONFIGURATION, DataAttribute.SECURITY_FIRMWARE, Fc.ST, SubDataAttribute.CURRENT_VERSION, securityFirmwareVersion);
DeviceMessageLoggingService.logMessage(deviceMessageLog, deviceConnection.getDeviceIdentification(), deviceConnection.getOrganisationIdentification(), false);
return output;
}
};
return iec61850Client.sendCommandWithRetry(function, "GetFirmwareVersion", deviceConnection.getDeviceIdentification());
}
use of com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.DeviceConnection in project Protocol-Adapter-IEC61850 by OSGP.
the class Iec61850HealthCommand method execute.
@Override
public MeasurementDto execute(final Iec61850Client client, final DeviceConnection connection, final LogicalDevice logicalDevice, final int logicalDeviceIndex) throws NodeReadException {
final NodeContainer containingNode = connection.getFcModelNode(logicalDevice, logicalDeviceIndex, LogicalNode.LOGICAL_NODE_ZERO, DataAttribute.HEALTH, Fc.ST);
client.readNodeDataValues(connection.getConnection().getClientAssociation(), containingNode.getFcmodelNode());
return this.translate(containingNode);
}
Aggregations