Search in sources :

Example 1 with Iec61850EnableReportingCommand

use of com.alliander.osgp.adapter.protocol.iec61850.infra.networking.services.commands.Iec61850EnableReportingCommand in project Protocol-Adapter-IEC61850 by OSGP.

the class DeviceRegistrationService method enableReporting.

protected void enableReporting(final DeviceConnection deviceConnection) {
    try {
        new Iec61850EnableReportingCommand().enableReportingOnDeviceWithoutUsingSequenceNumber(DeviceRegistrationService.this.iec61850DeviceConnectionService.getIec61850Client(), deviceConnection);
        // Don't disconnect now! The device should be able to send
        // reports.
        this.waitClearReportAndDisconnect(deviceConnection);
    } catch (final NodeWriteException e) {
        LOGGER.error("Unable to enabele reporting for device: " + deviceConnection.getDeviceIdentification(), e);
        DeviceRegistrationService.this.iec61850DeviceConnectionService.disconnect(deviceConnection, null);
    }
}
Also used : NodeWriteException(com.alliander.osgp.adapter.protocol.iec61850.exceptions.NodeWriteException) Iec61850EnableReportingCommand(com.alliander.osgp.adapter.protocol.iec61850.infra.networking.services.commands.Iec61850EnableReportingCommand)

Example 2 with Iec61850EnableReportingCommand

use of com.alliander.osgp.adapter.protocol.iec61850.infra.networking.services.commands.Iec61850EnableReportingCommand in project Protocol-Adapter-IEC61850 by OSGP.

the class Iec61850SsldDeviceService method enableReporting.

private void enableReporting(final DeviceConnection deviceConnection, final DeviceRequest deviceRequest) throws NodeWriteException {
    // Enabling device reporting.
    new Iec61850EnableReportingCommand().enableReportingOnDeviceWithoutUsingSequenceNumber(this.iec61850Client, deviceConnection);
    // Don't disconnect now! The device should be able to send reports.
    new Timer().schedule(new TimerTask() {

        @Override
        public void run() {
            try {
                new Iec61850ClearReportCommand().clearReportOnDevice(deviceConnection);
            } catch (final ProtocolAdapterException e) {
                LOGGER.error("Unable to clear report for device: " + deviceRequest.getDeviceIdentification(), e);
            }
            Iec61850SsldDeviceService.this.iec61850DeviceConnectionService.disconnect(deviceConnection, deviceRequest);
        }
    }, this.disconnectDelay);
}
Also used : Iec61850ClearReportCommand(com.alliander.osgp.adapter.protocol.iec61850.infra.networking.services.commands.Iec61850ClearReportCommand) Timer(java.util.Timer) TimerTask(java.util.TimerTask) Iec61850EnableReportingCommand(com.alliander.osgp.adapter.protocol.iec61850.infra.networking.services.commands.Iec61850EnableReportingCommand) ProtocolAdapterException(com.alliander.osgp.adapter.protocol.iec61850.exceptions.ProtocolAdapterException)

Aggregations

Iec61850EnableReportingCommand (com.alliander.osgp.adapter.protocol.iec61850.infra.networking.services.commands.Iec61850EnableReportingCommand)2 NodeWriteException (com.alliander.osgp.adapter.protocol.iec61850.exceptions.NodeWriteException)1 ProtocolAdapterException (com.alliander.osgp.adapter.protocol.iec61850.exceptions.ProtocolAdapterException)1 Iec61850ClearReportCommand (com.alliander.osgp.adapter.protocol.iec61850.infra.networking.services.commands.Iec61850ClearReportCommand)1 Timer (java.util.Timer)1 TimerTask (java.util.TimerTask)1