class SetRandomisationSettingsCommandExecutor extends AbstractCommandExecutor<SetRandomisationSettingsRequestDataDto, AccessResultCode> {

    @Override
    public AccessResultCode execute(final DlmsConnectionManager conn, final DlmsDevice device,
            final SetRandomisationSettingsRequestDataDto setRandomisationSettingsRequestDataDto)
            throws ProtocolAdapterException {

        LOGGER.info("Executing SetRandomisationSettingsCommandExecutor. Data = {}",
                setRandomisationSettingsRequestDataDto);

        boolean directAttach = setRandomisationSettingsRequestDataDto.getDirectAttach() == 1;
        int randomisationStartWindow = setRandomisationSettingsRequestDataDto.getRandomisationStartWindow();
        int multiplicationFactor = setRandomisationSettingsRequestDataDto.getMultiplicationFactor();
        int numberOfRetries = setRandomisationSettingsRequestDataDto.getNumberOfRetries();

        if (directAttach) {
            LOGGER.info("Enabling directAttach on device {}.", device.getDeviceIdentification());
            writeDirectAttach(conn, device, true);
        } else {
            LOGGER.info("Disabling directAttach and setting Randomisation Settings for device {}.",
                    device.getDeviceIdentification());
            writeDirectAttach(conn, device, false);
            writeRandomisationSettings(conn, device, randomisationStartWindow, multiplicationFactor, numberOfRetries);
        }

        return AccessResultCode.SUCCESS;

    }

    @Autowired public  SetRandomisationSettingsCommandExecutor(final DlmsObjectConfigService dlmsObjectConfigService,
            final ProtocolServiceLookup protocolServiceLookup);

}