use of com.alliander.osgp.adapter.protocol.iec61850.infra.networking.services.commands.Iec61850ClearReportCommand in project Protocol-Adapter-IEC61850 by OSGP.
the class Iec61850EnableReportingCommand method enableReportingOnDeviceWithoutUsingSequenceNumber.
/**
* Enable reporting so the device can send reports. This version of the
* function does not use the 'sequence number' to filter incoming reports.
* When using the {@link Iec61850ClearReportCommand} the 'sequence number'
* will always be reset to 0.
*
* @throws NodeWriteException
* In case writing of data-attributes fails.
*/
public void enableReportingOnDeviceWithoutUsingSequenceNumber(final Iec61850Client iec61850Client, final DeviceConnection deviceConnection) throws NodeWriteException {
final NodeContainer reporting = deviceConnection.getFcModelNode(LogicalDevice.LIGHTING, LogicalNode.LOGICAL_NODE_ZERO, DataAttribute.REPORTING, Fc.BR);
final Iec61850ClientBaseEventListener reportListener = deviceConnection.getConnection().getIec61850ClientAssociation().getReportListener();
reportListener.setSqNum(0);
reporting.writeBoolean(SubDataAttribute.ENABLE_REPORTING, true);
LOGGER.info("Allowing device {} to send reports containing events", deviceConnection.getDeviceIdentification());
}
use of com.alliander.osgp.adapter.protocol.iec61850.infra.networking.services.commands.Iec61850ClearReportCommand 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);
}
Aggregations