/**
 * Copyright (c) 2010-2020 Contributors to the openHAB project
 *
 * See the NOTICE file(s) distributed with this work for additional
 * information.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License 2.0 which is available at
 * http://www.eclipse.org/legal/epl-2.0
 *
 * SPDX-License-Identifier: EPL-2.0
 */

 /* ***********************************************************
 * This file was automatically generated on 2022-01-03.      *
 *                                                           *
 * openHAB Bindings Version 2.0.0                            *
 *                                                           *
 * If you have a bugfix for this file and want to commit it, *
 * please fix the bug in the generator. You can find a link  *
 * to the generators git repository on tinkerforge.com       *
 *************************************************************/

package org.openhab.binding.tinkerforge.internal.device;

import java.net.URI;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import org.eclipse.smarthome.config.core.Configuration;
import org.eclipse.smarthome.config.core.ConfigDescription;
import org.eclipse.smarthome.config.core.ConfigDescriptionBuilder;
import org.eclipse.smarthome.config.core.ConfigDescriptionParameter.Type;
import org.eclipse.smarthome.config.core.ConfigDescriptionParameterBuilder;
import org.eclipse.smarthome.config.core.ConfigDescriptionParameterGroup;
import org.eclipse.smarthome.config.core.ParameterOption;
import org.eclipse.smarthome.core.types.State;
import org.eclipse.smarthome.core.types.StateOption;
import org.eclipse.smarthome.core.types.Command;
import org.eclipse.smarthome.core.types.CommandDescriptionBuilder;
import org.eclipse.smarthome.core.types.CommandOption;
import org.eclipse.smarthome.core.thing.ChannelUID;
import org.eclipse.smarthome.core.thing.ThingStatus;
import org.eclipse.smarthome.core.thing.ThingTypeUID;
import org.eclipse.smarthome.core.thing.binding.BaseThingHandler;
import org.eclipse.smarthome.core.thing.type.ChannelDefinitionBuilder;
import org.eclipse.smarthome.core.thing.type.ChannelType;
import org.eclipse.smarthome.core.thing.type.ChannelTypeBuilder;
import org.eclipse.smarthome.core.thing.type.ChannelTypeUID;
import org.eclipse.smarthome.core.types.RefreshType;
import org.eclipse.smarthome.core.thing.type.ThingType;
import org.eclipse.smarthome.core.thing.type.ThingTypeBuilder;
import org.eclipse.smarthome.core.types.StateDescriptionFragmentBuilder;
import org.openhab.binding.tinkerforge.internal.TinkerforgeBindingConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.eclipse.smarthome.core.library.types.DecimalType;
import org.eclipse.smarthome.core.library.types.QuantityType;
import org.eclipse.smarthome.core.library.unit.MetricPrefix;
import org.eclipse.smarthome.core.library.unit.SIUnits;
import org.eclipse.smarthome.core.library.unit.SmartHomeUnits;
import org.eclipse.smarthome.core.library.types.OpenClosedType;
import org.eclipse.smarthome.core.library.types.StringType;

import com.tinkerforge.BrickletIndustrialCounter;
import com.tinkerforge.IPConnection;
import com.tinkerforge.TinkerforgeException;

import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;

/**
 * Wraps the Java Bindings of the Industrial Counter Bricklet.
 * @author Erik Fleckstein - Initial contribution
 */
@NonNullByDefault
public class BrickletIndustrialCounterWrapper extends BrickletIndustrialCounter implements CoMCUFlashable, DeviceWrapper {
    public static final DeviceInfo DEVICE_INFO = new DeviceInfo(BrickletIndustrialCounter.DEVICE_DISPLAY_NAME, "brickletindustrialcounter", BrickletIndustrialCounter.DEVICE_IDENTIFIER, BrickletIndustrialCounterWrapper.class, BrickletIndustrialCounterActions.class, "2.0.0", true);

    public BrickletIndustrialCounterWrapper(String uid, IPConnection ipcon) {
        super(uid, ipcon);
    }

    private List<ScheduledFuture<?>> manualChannelUpdates = new ArrayList<>();
    private List<ListenerReg<?>> listenerRegs = new ArrayList<>();

    public void cancelManualUpdates() {
        manualChannelUpdates.forEach(f -> f.cancel(true));
    }

    public <T> T reg(T listener, Consumer<T> toRemove) {
        listenerRegs.add(new ListenerReg<T>(listener, toRemove));
        return listener;
    }

    
    private final Logger logger = LoggerFactory.getLogger(BrickletIndustrialCounterWrapper.class);

    @Override
    public void initialize(org.eclipse.smarthome.config.core.Configuration config, Function<String, org.eclipse.smarthome.config.core.Configuration> getChannelConfigFn, BiConsumer<String, org.eclipse.smarthome.core.types.State> updateStateFn, BiConsumer<String, String> triggerChannelFn, ScheduledExecutorService scheduler, BaseThingHandler handler) throws TinkerforgeException {
        this.setResponseExpectedAll(true);
        BrickletIndustrialCounterConfig cfg = (BrickletIndustrialCounterConfig) config.as(BrickletIndustrialCounterConfig.class);
        if(cfg.enableChannel0) {
this.addAllCounterListener(this.reg((counter) -> {if(true) {updateStateFn.accept("BrickletIndustrialCounterCounterChannel0", transformBrickletIndustrialCounterCounterChannel0Callback0(counter, cfg));}}, this::removeAllCounterListener));}
		if(cfg.enableChannel1) {
this.addAllCounterListener(this.reg((counter) -> {if(true) {updateStateFn.accept("BrickletIndustrialCounterCounterChannel1", transformBrickletIndustrialCounterCounterChannel1Callback0(counter, cfg));}}, this::removeAllCounterListener));}
		if(cfg.enableChannel2) {
this.addAllCounterListener(this.reg((counter) -> {if(true) {updateStateFn.accept("BrickletIndustrialCounterCounterChannel2", transformBrickletIndustrialCounterCounterChannel2Callback0(counter, cfg));}}, this::removeAllCounterListener));}
		if(cfg.enableChannel3) {
this.addAllCounterListener(this.reg((counter) -> {if(true) {updateStateFn.accept("BrickletIndustrialCounterCounterChannel3", transformBrickletIndustrialCounterCounterChannel3Callback0(counter, cfg));}}, this::removeAllCounterListener));}
		if(cfg.enableChannel0) {
this.addAllSignalDataListener(this.reg((dutyCycle, period, frequency, value) -> {if(true) {updateStateFn.accept("BrickletIndustrialCounterDutyCycle0", transformBrickletIndustrialCounterDutyCycle0Callback0(dutyCycle, period, frequency, value, cfg));}}, this::removeAllSignalDataListener));}
		if(cfg.enableChannel1) {
this.addAllSignalDataListener(this.reg((dutyCycle, period, frequency, value) -> {if(true) {updateStateFn.accept("BrickletIndustrialCounterDutyCycle1", transformBrickletIndustrialCounterDutyCycle1Callback0(dutyCycle, period, frequency, value, cfg));}}, this::removeAllSignalDataListener));}
		if(cfg.enableChannel2) {
this.addAllSignalDataListener(this.reg((dutyCycle, period, frequency, value) -> {if(true) {updateStateFn.accept("BrickletIndustrialCounterDutyCycle2", transformBrickletIndustrialCounterDutyCycle2Callback0(dutyCycle, period, frequency, value, cfg));}}, this::removeAllSignalDataListener));}
		if(cfg.enableChannel3) {
this.addAllSignalDataListener(this.reg((dutyCycle, period, frequency, value) -> {if(true) {updateStateFn.accept("BrickletIndustrialCounterDutyCycle3", transformBrickletIndustrialCounterDutyCycle3Callback0(dutyCycle, period, frequency, value, cfg));}}, this::removeAllSignalDataListener));}
		if(cfg.enableChannel0) {
this.addAllSignalDataListener(this.reg((dutyCycle, period, frequency, value) -> {if(true) {updateStateFn.accept("BrickletIndustrialCounterPeriod0", transformBrickletIndustrialCounterPeriod0Callback0(dutyCycle, period, frequency, value, cfg));}}, this::removeAllSignalDataListener));}
		if(cfg.enableChannel1) {
this.addAllSignalDataListener(this.reg((dutyCycle, period, frequency, value) -> {if(true) {updateStateFn.accept("BrickletIndustrialCounterPeriod1", transformBrickletIndustrialCounterPeriod1Callback0(dutyCycle, period, frequency, value, cfg));}}, this::removeAllSignalDataListener));}
		if(cfg.enableChannel2) {
this.addAllSignalDataListener(this.reg((dutyCycle, period, frequency, value) -> {if(true) {updateStateFn.accept("BrickletIndustrialCounterPeriod2", transformBrickletIndustrialCounterPeriod2Callback0(dutyCycle, period, frequency, value, cfg));}}, this::removeAllSignalDataListener));}
		if(cfg.enableChannel3) {
this.addAllSignalDataListener(this.reg((dutyCycle, period, frequency, value) -> {if(true) {updateStateFn.accept("BrickletIndustrialCounterPeriod3", transformBrickletIndustrialCounterPeriod3Callback0(dutyCycle, period, frequency, value, cfg));}}, this::removeAllSignalDataListener));}
		if(cfg.enableChannel0) {
this.addAllSignalDataListener(this.reg((dutyCycle, period, frequency, value) -> {if(true) {updateStateFn.accept("BrickletIndustrialCounterFrequency0", transformBrickletIndustrialCounterFrequency0Callback0(dutyCycle, period, frequency, value, cfg));}}, this::removeAllSignalDataListener));}
		if(cfg.enableChannel1) {
this.addAllSignalDataListener(this.reg((dutyCycle, period, frequency, value) -> {if(true) {updateStateFn.accept("BrickletIndustrialCounterFrequency1", transformBrickletIndustrialCounterFrequency1Callback0(dutyCycle, period, frequency, value, cfg));}}, this::removeAllSignalDataListener));}
		if(cfg.enableChannel2) {
this.addAllSignalDataListener(this.reg((dutyCycle, period, frequency, value) -> {if(true) {updateStateFn.accept("BrickletIndustrialCounterFrequency2", transformBrickletIndustrialCounterFrequency2Callback0(dutyCycle, period, frequency, value, cfg));}}, this::removeAllSignalDataListener));}
		if(cfg.enableChannel3) {
this.addAllSignalDataListener(this.reg((dutyCycle, period, frequency, value) -> {if(true) {updateStateFn.accept("BrickletIndustrialCounterFrequency3", transformBrickletIndustrialCounterFrequency3Callback0(dutyCycle, period, frequency, value, cfg));}}, this::removeAllSignalDataListener));}
		if(cfg.enableChannel0) {
this.addAllSignalDataListener(this.reg((dutyCycle, period, frequency, value) -> {if(true) {updateStateFn.accept("BrickletIndustrialCounterValue0", transformBrickletIndustrialCounterValue0Callback0(dutyCycle, period, frequency, value, cfg));}}, this::removeAllSignalDataListener));}
		if(cfg.enableChannel1) {
this.addAllSignalDataListener(this.reg((dutyCycle, period, frequency, value) -> {if(true) {updateStateFn.accept("BrickletIndustrialCounterValue1", transformBrickletIndustrialCounterValue1Callback0(dutyCycle, period, frequency, value, cfg));}}, this::removeAllSignalDataListener));}
		if(cfg.enableChannel2) {
this.addAllSignalDataListener(this.reg((dutyCycle, period, frequency, value) -> {if(true) {updateStateFn.accept("BrickletIndustrialCounterValue2", transformBrickletIndustrialCounterValue2Callback0(dutyCycle, period, frequency, value, cfg));}}, this::removeAllSignalDataListener));}
		if(cfg.enableChannel3) {
this.addAllSignalDataListener(this.reg((dutyCycle, period, frequency, value) -> {if(true) {updateStateFn.accept("BrickletIndustrialCounterValue3", transformBrickletIndustrialCounterValue3Callback0(dutyCycle, period, frequency, value, cfg));}}, this::removeAllSignalDataListener));}
        this.setAllCounterActive(new boolean[]{cfg.enableChannel0, cfg.enableChannel1, cfg.enableChannel2, cfg.enableChannel3});
		    this.setAllCounterCallbackConfiguration(cfg.counterUpdateInterval, true);
		    this.setAllSignalDataCallbackConfiguration(cfg.signalDataUpdateInterval, true);
		this.setStatusLEDConfig(cfg.statusLEDConfig);
		if (cfg.enableChannel0) {
		BrickletIndustrialCounterCounterConfig channelCfg = getChannelConfigFn.apply("BrickletIndustrialCounterCounterChannel0").as(BrickletIndustrialCounterCounterConfig.class);
		this.setCounterConfiguration(0, channelCfg.countEdge, channelCfg.countDirection, channelCfg.dutyCyclePrescaler, channelCfg.frequencyIntegrationTime);
		            this.setChannelLEDConfig(0, channelCfg.channelLEDConfiguration);
		}
		if (cfg.enableChannel1) {
		BrickletIndustrialCounterCounterConfig channelCfg = getChannelConfigFn.apply("BrickletIndustrialCounterCounterChannel1").as(BrickletIndustrialCounterCounterConfig.class);
		this.setCounterConfiguration(1, channelCfg.countEdge, channelCfg.countDirection, channelCfg.dutyCyclePrescaler, channelCfg.frequencyIntegrationTime);
		            this.setChannelLEDConfig(1, channelCfg.channelLEDConfiguration);
		}
		if (cfg.enableChannel2) {
		BrickletIndustrialCounterCounterConfig channelCfg = getChannelConfigFn.apply("BrickletIndustrialCounterCounterChannel2").as(BrickletIndustrialCounterCounterConfig.class);
		this.setCounterConfiguration(2, channelCfg.countEdge, channelCfg.countDirection, channelCfg.dutyCyclePrescaler, channelCfg.frequencyIntegrationTime);
		            this.setChannelLEDConfig(2, channelCfg.channelLEDConfiguration);
		}
		if (cfg.enableChannel3) {
		BrickletIndustrialCounterCounterConfig channelCfg = getChannelConfigFn.apply("BrickletIndustrialCounterCounterChannel3").as(BrickletIndustrialCounterCounterConfig.class);
		this.setCounterConfiguration(3, channelCfg.countEdge, channelCfg.countDirection, channelCfg.dutyCyclePrescaler, channelCfg.frequencyIntegrationTime);
		            this.setChannelLEDConfig(3, channelCfg.channelLEDConfiguration);
		}
    }

    @Override
    public void dispose(org.eclipse.smarthome.config.core.Configuration config) throws TinkerforgeException {
        listenerRegs.forEach(ListenerReg::deregister);

        
        this.setAllCounterCallbackConfiguration(0, true);
		    this.setAllSignalDataCallbackConfiguration(0, true);
    }

    @Override
    public List<String> getEnabledChannels(org.eclipse.smarthome.config.core.Configuration config) throws TinkerforgeException{
        BrickletIndustrialCounterConfig cfg = (BrickletIndustrialCounterConfig) config.as(BrickletIndustrialCounterConfig.class);
List<String> result = new ArrayList<String>();
        if (cfg.enableChannel0) {
                result.add("BrickletIndustrialCounterCounterChannel0");
            }
		if (cfg.enableChannel1) {
                result.add("BrickletIndustrialCounterCounterChannel1");
            }
		if (cfg.enableChannel2) {
                result.add("BrickletIndustrialCounterCounterChannel2");
            }
		if (cfg.enableChannel3) {
                result.add("BrickletIndustrialCounterCounterChannel3");
            }
		if (cfg.enableChannel0) {
                result.add("BrickletIndustrialCounterDutyCycle0");
            }
		if (cfg.enableChannel1) {
                result.add("BrickletIndustrialCounterDutyCycle1");
            }
		if (cfg.enableChannel2) {
                result.add("BrickletIndustrialCounterDutyCycle2");
            }
		if (cfg.enableChannel3) {
                result.add("BrickletIndustrialCounterDutyCycle3");
            }
		if (cfg.enableChannel0) {
                result.add("BrickletIndustrialCounterPeriod0");
            }
		if (cfg.enableChannel1) {
                result.add("BrickletIndustrialCounterPeriod1");
            }
		if (cfg.enableChannel2) {
                result.add("BrickletIndustrialCounterPeriod2");
            }
		if (cfg.enableChannel3) {
                result.add("BrickletIndustrialCounterPeriod3");
            }
		if (cfg.enableChannel0) {
                result.add("BrickletIndustrialCounterFrequency0");
            }
		if (cfg.enableChannel1) {
                result.add("BrickletIndustrialCounterFrequency1");
            }
		if (cfg.enableChannel2) {
                result.add("BrickletIndustrialCounterFrequency2");
            }
		if (cfg.enableChannel3) {
                result.add("BrickletIndustrialCounterFrequency3");
            }
		if (cfg.enableChannel0) {
                result.add("BrickletIndustrialCounterValue0");
            }
		if (cfg.enableChannel1) {
                result.add("BrickletIndustrialCounterValue1");
            }
		if (cfg.enableChannel2) {
                result.add("BrickletIndustrialCounterValue2");
            }
		if (cfg.enableChannel3) {
                result.add("BrickletIndustrialCounterValue3");
            }
        return result;
    }

    public static @Nullable ChannelType getChannelType(ChannelTypeUID channelTypeUID) {
        switch(channelTypeUID.getId()) {
            case "BrickletIndustrialCounterDutyCycle":
                return ChannelTypeBuilder.state(new ChannelTypeUID("tinkerforge", "BrickletIndustrialCounterDutyCycle"), "NOT USED", "Number:Dimensionless").withConfigDescriptionURI(URI.create("channel-type:tinkerforge:BrickletIndustrialCounterDutyCycle")).withDescription("The signal's duty cycle.")
.withStateDescription(StateDescriptionFragmentBuilder.create().withMinimum(BigDecimal.valueOf(0)).withMaximum(BigDecimal.valueOf(100)).withStep(BigDecimal.valueOf(0.01)).withPattern("%.2f %unit%").withReadOnly(true).build().toStateDescription()).build();
            case "BrickletIndustrialCounterPeriod":
                return ChannelTypeBuilder.state(new ChannelTypeUID("tinkerforge", "BrickletIndustrialCounterPeriod"), "NOT USED", "Number:Time").withConfigDescriptionURI(URI.create("channel-type:tinkerforge:BrickletIndustrialCounterPeriod")).withDescription("The signal's period")
.withStateDescription(StateDescriptionFragmentBuilder.create().withPattern("%.9f %unit%").withReadOnly(true).build().toStateDescription()).build();
            case "BrickletIndustrialCounterFrequency":
                return ChannelTypeBuilder.state(new ChannelTypeUID("tinkerforge", "BrickletIndustrialCounterFrequency"), "NOT USED", "Number:Frequency").withConfigDescriptionURI(URI.create("channel-type:tinkerforge:BrickletIndustrialCounterFrequency")).withDescription("The signal's frequency.")
.withStateDescription(StateDescriptionFragmentBuilder.create().withPattern("%.3f %unit%").withReadOnly(true).build().toStateDescription()).build();
            case "BrickletIndustrialCounterValue":
                return ChannelTypeBuilder.state(new ChannelTypeUID("tinkerforge", "BrickletIndustrialCounterValue"), "NOT USED", "Contact").withConfigDescriptionURI(URI.create("channel-type:tinkerforge:BrickletIndustrialCounterValue")).withDescription("The signal's current value").build();
            case "BrickletIndustrialCounterCounter":
                return ChannelTypeBuilder.state(new ChannelTypeUID("tinkerforge", "BrickletIndustrialCounterCounter"), "Counter Value", "Number:Dimensionless").withConfigDescriptionURI(URI.create("channel-type:tinkerforge:BrickletIndustrialCounterCounter")).withDescription("The current counter value for the channel.")
.withStateDescription(StateDescriptionFragmentBuilder.create().withMinimum(BigDecimal.valueOf(-140737488355328L)).withMaximum(BigDecimal.valueOf(140737488355327L)).withStep(BigDecimal.valueOf(1)).withPattern("%d").withReadOnly(false).build().toStateDescription()).build();
default:
                break;
        }

        return null;
    }

    public static ThingType getThingType(ThingTypeUID thingTypeUID) {
             Map<String, String> thingTypeProperties = ThingTypeBuilder.instance(thingTypeUID, "unused").build().getProperties();
             Map<String, String> props = new HashMap<String, String>(thingTypeProperties);
             props.putIfAbsent(TinkerforgeBindingConstants.PROPERTY_MINIMUM_FIRMWARE_VERSION, DEVICE_INFO.minimumFWVersion);
        return ThingTypeBuilder.instance(thingTypeUID, "Tinkerforge Industrial Counter Bricklet").isListed(false).withSupportedBridgeTypeUIDs(Arrays.asList(TinkerforgeBindingConstants.THING_TYPE_BRICK_DAEMON.toString())).withConfigDescriptionURI(URI.create("thing-type:tinkerforge:" + thingTypeUID.getId())).withDescription("4 channel counter up to 4MHz").withChannelDefinitions(Arrays.asList(new ChannelDefinitionBuilder("BrickletIndustrialCounterCounterChannel0", new ChannelTypeUID("tinkerforge", "BrickletIndustrialCounterCounter")).withLabel("Channel 0 - Counter").build(), new ChannelDefinitionBuilder("BrickletIndustrialCounterCounterChannel1", new ChannelTypeUID("tinkerforge", "BrickletIndustrialCounterCounter")).withLabel("Channel 1 - Counter").build(), new ChannelDefinitionBuilder("BrickletIndustrialCounterCounterChannel2", new ChannelTypeUID("tinkerforge", "BrickletIndustrialCounterCounter")).withLabel("Channel 2 - Counter").build(), new ChannelDefinitionBuilder("BrickletIndustrialCounterCounterChannel3", new ChannelTypeUID("tinkerforge", "BrickletIndustrialCounterCounter")).withLabel("Channel 3 - Counter").build(), new ChannelDefinitionBuilder("BrickletIndustrialCounterDutyCycle0", new ChannelTypeUID("tinkerforge", "BrickletIndustrialCounterDutyCycle")).withLabel("Channel 0 - Duty Cycle").build(), new ChannelDefinitionBuilder("BrickletIndustrialCounterDutyCycle1", new ChannelTypeUID("tinkerforge", "BrickletIndustrialCounterDutyCycle")).withLabel("Channel 1 - Duty Cycle").build(), new ChannelDefinitionBuilder("BrickletIndustrialCounterDutyCycle2", new ChannelTypeUID("tinkerforge", "BrickletIndustrialCounterDutyCycle")).withLabel("Channel 2 - Duty Cycle").build(), new ChannelDefinitionBuilder("BrickletIndustrialCounterDutyCycle3", new ChannelTypeUID("tinkerforge", "BrickletIndustrialCounterDutyCycle")).withLabel("Channel 3 - Duty Cycle").build(), new ChannelDefinitionBuilder("BrickletIndustrialCounterPeriod0", new ChannelTypeUID("tinkerforge", "BrickletIndustrialCounterPeriod")).withLabel("Channel 0 - Period").build(), new ChannelDefinitionBuilder("BrickletIndustrialCounterPeriod1", new ChannelTypeUID("tinkerforge", "BrickletIndustrialCounterPeriod")).withLabel("Channel 1 - Period").build(), new ChannelDefinitionBuilder("BrickletIndustrialCounterPeriod2", new ChannelTypeUID("tinkerforge", "BrickletIndustrialCounterPeriod")).withLabel("Channel 2 - Period").build(), new ChannelDefinitionBuilder("BrickletIndustrialCounterPeriod3", new ChannelTypeUID("tinkerforge", "BrickletIndustrialCounterPeriod")).withLabel("Channel 3 - Period").build(), new ChannelDefinitionBuilder("BrickletIndustrialCounterFrequency0", new ChannelTypeUID("tinkerforge", "BrickletIndustrialCounterFrequency")).withLabel("Channel 0 - Frequency").build(), new ChannelDefinitionBuilder("BrickletIndustrialCounterFrequency1", new ChannelTypeUID("tinkerforge", "BrickletIndustrialCounterFrequency")).withLabel("Channel 1 - Frequency").build(), new ChannelDefinitionBuilder("BrickletIndustrialCounterFrequency2", new ChannelTypeUID("tinkerforge", "BrickletIndustrialCounterFrequency")).withLabel("Channel 2 - Frequency").build(), new ChannelDefinitionBuilder("BrickletIndustrialCounterFrequency3", new ChannelTypeUID("tinkerforge", "BrickletIndustrialCounterFrequency")).withLabel("Channel 3 - Frequency").build(), new ChannelDefinitionBuilder("BrickletIndustrialCounterValue0", new ChannelTypeUID("tinkerforge", "BrickletIndustrialCounterValue")).withLabel("Channel 0 - Value").build(), new ChannelDefinitionBuilder("BrickletIndustrialCounterValue1", new ChannelTypeUID("tinkerforge", "BrickletIndustrialCounterValue")).withLabel("Channel 1 - Value").build(), new ChannelDefinitionBuilder("BrickletIndustrialCounterValue2", new ChannelTypeUID("tinkerforge", "BrickletIndustrialCounterValue")).withLabel("Channel 2 - Value").build(), new ChannelDefinitionBuilder("BrickletIndustrialCounterValue3", new ChannelTypeUID("tinkerforge", "BrickletIndustrialCounterValue")).withLabel("Channel 3 - Value").build())).withProperties(props).build();
    }

    public static @Nullable ConfigDescription getConfigDescription(URI uri) {
        switch(uri.toASCIIString()) {
            case "thing-type:tinkerforge:brickletindustrialcounter":
                return ConfigDescriptionBuilder.create(uri).withParameters(Arrays.asList(ConfigDescriptionParameterBuilder.create("enableChannel0", Type.BOOLEAN).withDefault("true").withDescription("Activates/deactivates the counter of channel 0.").withLabel("Enable Channel 0").build(), ConfigDescriptionParameterBuilder.create("enableChannel1", Type.BOOLEAN).withDefault("true").withDescription("Activates/deactivates the counter of channel 1.").withLabel("Enable Channel 1").build(), ConfigDescriptionParameterBuilder.create("enableChannel2", Type.BOOLEAN).withDefault("true").withDescription("Activates/deactivates the counter of channel 2.").withLabel("Enable Channel 2").build(), ConfigDescriptionParameterBuilder.create("enableChannel3", Type.BOOLEAN).withDefault("true").withDescription("Activates/deactivates the counter of channel 3.").withLabel("Enable Channel 3").build(), ConfigDescriptionParameterBuilder.create("counterUpdateInterval", Type.INTEGER).withDefault("1000").withDescription("Specifies the update interval for all counters in milliseconds. A value of 0 disables automatic updates.").withGroupName("update_intervals").withLabel("Counter Update Interval").withUnit("ms").withMinimum(BigDecimal.valueOf(0)).withMaximum(BigDecimal.valueOf(4294967295L)).build(), ConfigDescriptionParameterBuilder.create("signalDataUpdateInterval", Type.INTEGER).withDefault("1000").withDescription("Specifies the update interval for all signal data in milliseconds. A value of 0 disables automatic updates.").withGroupName("update_intervals").withLabel("Signal Data Update Interval").withUnit("ms").withMinimum(BigDecimal.valueOf(0)).withMaximum(BigDecimal.valueOf(4294967295L)).build(), ConfigDescriptionParameterBuilder.create("statusLEDConfig", Type.INTEGER).withDefault("3").withDescription("The status LED configuration. By default the LED shows communication traffic between Brick and Bricklet, it flickers once for every 10 received data packets.<br/><br/>You can also turn the LED permanently on/off or show a heartbeat.<br/><br/>If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.").withLabel("Status LED Configuration").withAdvanced(true).withLimitToOptions(true).withOptions(Arrays.asList(new ParameterOption("0", "Off"), new ParameterOption("1", "On"), new ParameterOption("2", "Show Heartbeat"), new ParameterOption("3", "Show Status"))).build())).withParameterGroups(Arrays.asList()).build();
            case "channel-type:tinkerforge:BrickletIndustrialCounterDutyCycle":
                return ConfigDescriptionBuilder.create(uri).withParameters(Arrays.asList()).withParameterGroups(Arrays.asList()).build();
            case "channel-type:tinkerforge:BrickletIndustrialCounterPeriod":
                return ConfigDescriptionBuilder.create(uri).withParameters(Arrays.asList()).withParameterGroups(Arrays.asList()).build();
            case "channel-type:tinkerforge:BrickletIndustrialCounterFrequency":
                return ConfigDescriptionBuilder.create(uri).withParameters(Arrays.asList()).withParameterGroups(Arrays.asList()).build();
            case "channel-type:tinkerforge:BrickletIndustrialCounterValue":
                return ConfigDescriptionBuilder.create(uri).withParameters(Arrays.asList()).withParameterGroups(Arrays.asList()).build();
            case "channel-type:tinkerforge:BrickletIndustrialCounterCounter":
                return ConfigDescriptionBuilder.create(uri).withParameters(Arrays.asList(ConfigDescriptionParameterBuilder.create("countEdge", Type.INTEGER).withDefault("0").withDescription("The counter can count on rising, falling or both edges.").withLabel("Count Edge").withLimitToOptions(true).withOptions(Arrays.asList(new ParameterOption("0", "Rising"), new ParameterOption("1", "Falling"), new ParameterOption("2", "Both"))).build(), ConfigDescriptionParameterBuilder.create("countDirection", Type.INTEGER).withDefault("0").withDescription("The counter can count up or down. You can also use another channel as direction input: Channel 0 additionally supports to use the input of channel 2 as direction. You can configure channel 0 to count up if the value of channel 2 is high and down if the value is low and the other way around. Additionally channel 3 can use channel 1 as direction input in the same manner.").withLabel("Count Direction").withLimitToOptions(true).withOptions(Arrays.asList(new ParameterOption("0", "Up"), new ParameterOption("1", "Down"), new ParameterOption("2", "External Up"), new ParameterOption("3", "External Down"))).build(), ConfigDescriptionParameterBuilder.create("dutyCyclePrescaler", Type.INTEGER).withDefault("0").withDescription("Sets a divider for the internal clock. See here: https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Industrial_Counter.html#duty-cycle-prescaler-and-frequency-integration-time for details.").withLabel("Duty Cycle Prescaler").withLimitToOptions(true).withOptions(Arrays.asList(new ParameterOption("0", "1"), new ParameterOption("1", "2"), new ParameterOption("2", "4"), new ParameterOption("3", "8"), new ParameterOption("4", "16"), new ParameterOption("5", "32"), new ParameterOption("6", "64"), new ParameterOption("7", "128"), new ParameterOption("8", "256"), new ParameterOption("9", "512"), new ParameterOption("10", "1024"), new ParameterOption("11", "2048"), new ParameterOption("12", "4096"), new ParameterOption("13", "8192"), new ParameterOption("14", "16384"), new ParameterOption("15", "32768"))).build(), ConfigDescriptionParameterBuilder.create("frequencyIntegrationTime", Type.INTEGER).withDefault("3").withDescription("Sets the integration time for the frequency measurement. See here: https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Industrial_Counter.html#duty-cycle-prescaler-and-frequency-integration-time for details.").withLabel("Frequency Integration Time").withLimitToOptions(true).withOptions(Arrays.asList(new ParameterOption("0", "128 MS"), new ParameterOption("1", "256 MS"), new ParameterOption("2", "512 MS"), new ParameterOption("3", "1024 MS"), new ParameterOption("4", "2048 MS"), new ParameterOption("5", "4096 MS"), new ParameterOption("6", "8192 MS"), new ParameterOption("7", "16384 MS"), new ParameterOption("8", "32768 MS"))).build(), ConfigDescriptionParameterBuilder.create("channelLEDConfiguration", Type.INTEGER).withDefault("3").withDescription("Each channel has a corresponding LED. You can turn the LED off, on or show a heartbeat. You can also set the LED to Channel Status. In this mode the LED is on if the channel is high and off otherwise.").withLabel("Channel LED").withLimitToOptions(true).withOptions(Arrays.asList(new ParameterOption("0", "Off"), new ParameterOption("1", "On"), new ParameterOption("2", "Show Heartbeat"), new ParameterOption("3", "Show Channel Status"))).build())).withParameterGroups(Arrays.asList()).build();
            default:
                break;
        }
        return null;
    }

        @Override
    public void refreshValue(String channel, org.eclipse.smarthome.config.core.Configuration config, org.eclipse.smarthome.config.core.Configuration channelConfig, BiConsumer<String, org.eclipse.smarthome.core.types.State> updateStateFn, BiConsumer<String, String> triggerChannelFn) throws TinkerforgeException {
        BrickletIndustrialCounterConfig cfg = (BrickletIndustrialCounterConfig) config.as(BrickletIndustrialCounterConfig.class);
switch(channel) {
            case "BrickletIndustrialCounterCounterChannel0":
                   {
            long value = this.getCounter(0);
            if(true)
                updateStateFn.accept(channel, transformBrickletIndustrialCounterCounterChannel0Getter0(value, cfg));
        }
                   return;
            case "BrickletIndustrialCounterCounterChannel1":
                   {
            long value = this.getCounter(1);
            if(true)
                updateStateFn.accept(channel, transformBrickletIndustrialCounterCounterChannel1Getter0(value, cfg));
        }
                   return;
            case "BrickletIndustrialCounterCounterChannel2":
                   {
            long value = this.getCounter(2);
            if(true)
                updateStateFn.accept(channel, transformBrickletIndustrialCounterCounterChannel2Getter0(value, cfg));
        }
                   return;
            case "BrickletIndustrialCounterCounterChannel3":
                   {
            long value = this.getCounter(3);
            if(true)
                updateStateFn.accept(channel, transformBrickletIndustrialCounterCounterChannel3Getter0(value, cfg));
        }
                   return;
            case "BrickletIndustrialCounterDutyCycle0":
                   {
            BrickletIndustrialCounter.SignalData value = this.getSignalData(0);
            if(true)
                updateStateFn.accept(channel, transformBrickletIndustrialCounterDutyCycle0Getter0(value, cfg));
        }
                   return;
            case "BrickletIndustrialCounterDutyCycle1":
                   {
            BrickletIndustrialCounter.SignalData value = this.getSignalData(1);
            if(true)
                updateStateFn.accept(channel, transformBrickletIndustrialCounterDutyCycle1Getter0(value, cfg));
        }
                   return;
            case "BrickletIndustrialCounterDutyCycle2":
                   {
            BrickletIndustrialCounter.SignalData value = this.getSignalData(2);
            if(true)
                updateStateFn.accept(channel, transformBrickletIndustrialCounterDutyCycle2Getter0(value, cfg));
        }
                   return;
            case "BrickletIndustrialCounterDutyCycle3":
                   {
            BrickletIndustrialCounter.SignalData value = this.getSignalData(3);
            if(true)
                updateStateFn.accept(channel, transformBrickletIndustrialCounterDutyCycle3Getter0(value, cfg));
        }
                   return;
            case "BrickletIndustrialCounterPeriod0":
                   {
            BrickletIndustrialCounter.SignalData value = this.getSignalData(0);
            if(true)
                updateStateFn.accept(channel, transformBrickletIndustrialCounterPeriod0Getter0(value, cfg));
        }
                   return;
            case "BrickletIndustrialCounterPeriod1":
                   {
            BrickletIndustrialCounter.SignalData value = this.getSignalData(1);
            if(true)
                updateStateFn.accept(channel, transformBrickletIndustrialCounterPeriod1Getter0(value, cfg));
        }
                   return;
            case "BrickletIndustrialCounterPeriod2":
                   {
            BrickletIndustrialCounter.SignalData value = this.getSignalData(2);
            if(true)
                updateStateFn.accept(channel, transformBrickletIndustrialCounterPeriod2Getter0(value, cfg));
        }
                   return;
            case "BrickletIndustrialCounterPeriod3":
                   {
            BrickletIndustrialCounter.SignalData value = this.getSignalData(3);
            if(true)
                updateStateFn.accept(channel, transformBrickletIndustrialCounterPeriod3Getter0(value, cfg));
        }
                   return;
            case "BrickletIndustrialCounterFrequency0":
                   {
            BrickletIndustrialCounter.SignalData value = this.getSignalData(0);
            if(true)
                updateStateFn.accept(channel, transformBrickletIndustrialCounterFrequency0Getter0(value, cfg));
        }
                   return;
            case "BrickletIndustrialCounterFrequency1":
                   {
            BrickletIndustrialCounter.SignalData value = this.getSignalData(1);
            if(true)
                updateStateFn.accept(channel, transformBrickletIndustrialCounterFrequency1Getter0(value, cfg));
        }
                   return;
            case "BrickletIndustrialCounterFrequency2":
                   {
            BrickletIndustrialCounter.SignalData value = this.getSignalData(2);
            if(true)
                updateStateFn.accept(channel, transformBrickletIndustrialCounterFrequency2Getter0(value, cfg));
        }
                   return;
            case "BrickletIndustrialCounterFrequency3":
                   {
            BrickletIndustrialCounter.SignalData value = this.getSignalData(3);
            if(true)
                updateStateFn.accept(channel, transformBrickletIndustrialCounterFrequency3Getter0(value, cfg));
        }
                   return;
            case "BrickletIndustrialCounterValue0":
                   {
            BrickletIndustrialCounter.SignalData value = this.getSignalData(0);
            if(true)
                updateStateFn.accept(channel, transformBrickletIndustrialCounterValue0Getter0(value, cfg));
        }
                   return;
            case "BrickletIndustrialCounterValue1":
                   {
            BrickletIndustrialCounter.SignalData value = this.getSignalData(1);
            if(true)
                updateStateFn.accept(channel, transformBrickletIndustrialCounterValue1Getter0(value, cfg));
        }
                   return;
            case "BrickletIndustrialCounterValue2":
                   {
            BrickletIndustrialCounter.SignalData value = this.getSignalData(2);
            if(true)
                updateStateFn.accept(channel, transformBrickletIndustrialCounterValue2Getter0(value, cfg));
        }
                   return;
            case "BrickletIndustrialCounterValue3":
                   {
            BrickletIndustrialCounter.SignalData value = this.getSignalData(3);
            if(true)
                updateStateFn.accept(channel, transformBrickletIndustrialCounterValue3Getter0(value, cfg));
        }
                   return;
default:
                logger.warn("Refresh for unknown channel {}", channel);
                break;
        }
    }
    

        @Override
    public List<SetterRefresh> handleCommand(org.eclipse.smarthome.config.core.Configuration config, org.eclipse.smarthome.config.core.Configuration channelConfig, String channel, Command command) throws TinkerforgeException {
        List<SetterRefresh> result = Collections.emptyList();
        
        switch(channel) {
            case "BrickletIndustrialCounterCounterChannel0":
                if (command instanceof Number) {
                    Number cmd = (Number) command;
this.setCounter(0, cmd.longValue());
                }
        
                else {
                    logger.warn("Command type {} not supported for channel {}. Please use one of Number.", command.getClass().getName(), channel);
                }
                
                break;
            case "BrickletIndustrialCounterCounterChannel1":
                if (command instanceof Number) {
                    Number cmd = (Number) command;
this.setCounter(1, cmd.longValue());
                }
        
                else {
                    logger.warn("Command type {} not supported for channel {}. Please use one of Number.", command.getClass().getName(), channel);
                }
                
                break;
            case "BrickletIndustrialCounterCounterChannel2":
                if (command instanceof Number) {
                    Number cmd = (Number) command;
this.setCounter(2, cmd.longValue());
                }
        
                else {
                    logger.warn("Command type {} not supported for channel {}. Please use one of Number.", command.getClass().getName(), channel);
                }
                
                break;
            case "BrickletIndustrialCounterCounterChannel3":
                if (command instanceof Number) {
                    Number cmd = (Number) command;
this.setCounter(3, cmd.longValue());
                }
        
                else {
                    logger.warn("Command type {} not supported for channel {}. Please use one of Number.", command.getClass().getName(), channel);
                }
                
                break;
default:
                logger.warn("Command for unknown channel {}", channel);
        }
        return result;
    }

        private org.eclipse.smarthome.core.types.State transformBrickletIndustrialCounterCounterChannel0Callback0(long[] counter, BrickletIndustrialCounterConfig cfg) {
        return new DecimalType(counter[0]);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIndustrialCounterCounterChannel1Callback0(long[] counter, BrickletIndustrialCounterConfig cfg) {
        return new DecimalType(counter[1]);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIndustrialCounterCounterChannel2Callback0(long[] counter, BrickletIndustrialCounterConfig cfg) {
        return new DecimalType(counter[2]);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIndustrialCounterCounterChannel3Callback0(long[] counter, BrickletIndustrialCounterConfig cfg) {
        return new DecimalType(counter[3]);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIndustrialCounterDutyCycle0Callback0(int[] dutyCycle, long[] period, long[] frequency, boolean[] value, BrickletIndustrialCounterConfig cfg) {
        return new QuantityType<>(dutyCycle[0] / 100.0, SmartHomeUnits.PERCENT);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIndustrialCounterDutyCycle1Callback0(int[] dutyCycle, long[] period, long[] frequency, boolean[] value, BrickletIndustrialCounterConfig cfg) {
        return new QuantityType<>(dutyCycle[1] / 100.0, SmartHomeUnits.PERCENT);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIndustrialCounterDutyCycle2Callback0(int[] dutyCycle, long[] period, long[] frequency, boolean[] value, BrickletIndustrialCounterConfig cfg) {
        return new QuantityType<>(dutyCycle[2] / 100.0, SmartHomeUnits.PERCENT);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIndustrialCounterDutyCycle3Callback0(int[] dutyCycle, long[] period, long[] frequency, boolean[] value, BrickletIndustrialCounterConfig cfg) {
        return new QuantityType<>(dutyCycle[3] / 100.0, SmartHomeUnits.PERCENT);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIndustrialCounterPeriod0Callback0(int[] dutyCycle, long[] period, long[] frequency, boolean[] value, BrickletIndustrialCounterConfig cfg) {
        return new QuantityType<>(period[0] / 1000000000.0, SmartHomeUnits.SECOND);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIndustrialCounterPeriod1Callback0(int[] dutyCycle, long[] period, long[] frequency, boolean[] value, BrickletIndustrialCounterConfig cfg) {
        return new QuantityType<>(period[1] / 1000000000.0, SmartHomeUnits.SECOND);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIndustrialCounterPeriod2Callback0(int[] dutyCycle, long[] period, long[] frequency, boolean[] value, BrickletIndustrialCounterConfig cfg) {
        return new QuantityType<>(period[2] / 1000000000.0, SmartHomeUnits.SECOND);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIndustrialCounterPeriod3Callback0(int[] dutyCycle, long[] period, long[] frequency, boolean[] value, BrickletIndustrialCounterConfig cfg) {
        return new QuantityType<>(period[3] / 1000000000.0, SmartHomeUnits.SECOND);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIndustrialCounterFrequency0Callback0(int[] dutyCycle, long[] period, long[] frequency, boolean[] value, BrickletIndustrialCounterConfig cfg) {
        return new QuantityType<>(frequency[0] / 1000.0, SmartHomeUnits.HERTZ);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIndustrialCounterFrequency1Callback0(int[] dutyCycle, long[] period, long[] frequency, boolean[] value, BrickletIndustrialCounterConfig cfg) {
        return new QuantityType<>(frequency[1] / 1000.0, SmartHomeUnits.HERTZ);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIndustrialCounterFrequency2Callback0(int[] dutyCycle, long[] period, long[] frequency, boolean[] value, BrickletIndustrialCounterConfig cfg) {
        return new QuantityType<>(frequency[2] / 1000.0, SmartHomeUnits.HERTZ);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIndustrialCounterFrequency3Callback0(int[] dutyCycle, long[] period, long[] frequency, boolean[] value, BrickletIndustrialCounterConfig cfg) {
        return new QuantityType<>(frequency[3] / 1000.0, SmartHomeUnits.HERTZ);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIndustrialCounterValue0Callback0(int[] dutyCycle, long[] period, long[] frequency, boolean[] value, BrickletIndustrialCounterConfig cfg) {
        return value[0] ? OpenClosedType.CLOSED : OpenClosedType.OPEN;
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIndustrialCounterValue1Callback0(int[] dutyCycle, long[] period, long[] frequency, boolean[] value, BrickletIndustrialCounterConfig cfg) {
        return value[1] ? OpenClosedType.CLOSED : OpenClosedType.OPEN;
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIndustrialCounterValue2Callback0(int[] dutyCycle, long[] period, long[] frequency, boolean[] value, BrickletIndustrialCounterConfig cfg) {
        return value[2] ? OpenClosedType.CLOSED : OpenClosedType.OPEN;
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIndustrialCounterValue3Callback0(int[] dutyCycle, long[] period, long[] frequency, boolean[] value, BrickletIndustrialCounterConfig cfg) {
        return value[3] ? OpenClosedType.CLOSED : OpenClosedType.OPEN;
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIndustrialCounterCounterChannel0Getter0(long value, BrickletIndustrialCounterConfig cfg) {
        return new DecimalType(value);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIndustrialCounterCounterChannel1Getter0(long value, BrickletIndustrialCounterConfig cfg) {
        return new DecimalType(value);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIndustrialCounterCounterChannel2Getter0(long value, BrickletIndustrialCounterConfig cfg) {
        return new DecimalType(value);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIndustrialCounterCounterChannel3Getter0(long value, BrickletIndustrialCounterConfig cfg) {
        return new DecimalType(value);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIndustrialCounterDutyCycle0Getter0(BrickletIndustrialCounter.SignalData value, BrickletIndustrialCounterConfig cfg) {
        return new QuantityType<>(value.dutyCycle / 100.0, SmartHomeUnits.PERCENT);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIndustrialCounterDutyCycle1Getter0(BrickletIndustrialCounter.SignalData value, BrickletIndustrialCounterConfig cfg) {
        return new QuantityType<>(value.dutyCycle / 100.0, SmartHomeUnits.PERCENT);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIndustrialCounterDutyCycle2Getter0(BrickletIndustrialCounter.SignalData value, BrickletIndustrialCounterConfig cfg) {
        return new QuantityType<>(value.dutyCycle / 100.0, SmartHomeUnits.PERCENT);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIndustrialCounterDutyCycle3Getter0(BrickletIndustrialCounter.SignalData value, BrickletIndustrialCounterConfig cfg) {
        return new QuantityType<>(value.dutyCycle / 100.0, SmartHomeUnits.PERCENT);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIndustrialCounterPeriod0Getter0(BrickletIndustrialCounter.SignalData value, BrickletIndustrialCounterConfig cfg) {
        return new QuantityType<>(value.period / 1000000000.0, SmartHomeUnits.SECOND);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIndustrialCounterPeriod1Getter0(BrickletIndustrialCounter.SignalData value, BrickletIndustrialCounterConfig cfg) {
        return new QuantityType<>(value.period / 1000000000.0, SmartHomeUnits.SECOND);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIndustrialCounterPeriod2Getter0(BrickletIndustrialCounter.SignalData value, BrickletIndustrialCounterConfig cfg) {
        return new QuantityType<>(value.period / 1000000000.0, SmartHomeUnits.SECOND);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIndustrialCounterPeriod3Getter0(BrickletIndustrialCounter.SignalData value, BrickletIndustrialCounterConfig cfg) {
        return new QuantityType<>(value.period / 1000000000.0, SmartHomeUnits.SECOND);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIndustrialCounterFrequency0Getter0(BrickletIndustrialCounter.SignalData value, BrickletIndustrialCounterConfig cfg) {
        return new QuantityType<>(value.frequency / 1000.0, SmartHomeUnits.HERTZ);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIndustrialCounterFrequency1Getter0(BrickletIndustrialCounter.SignalData value, BrickletIndustrialCounterConfig cfg) {
        return new QuantityType<>(value.frequency / 1000.0, SmartHomeUnits.HERTZ);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIndustrialCounterFrequency2Getter0(BrickletIndustrialCounter.SignalData value, BrickletIndustrialCounterConfig cfg) {
        return new QuantityType<>(value.frequency / 1000.0, SmartHomeUnits.HERTZ);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIndustrialCounterFrequency3Getter0(BrickletIndustrialCounter.SignalData value, BrickletIndustrialCounterConfig cfg) {
        return new QuantityType<>(value.frequency / 1000.0, SmartHomeUnits.HERTZ);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIndustrialCounterValue0Getter0(BrickletIndustrialCounter.SignalData value, BrickletIndustrialCounterConfig cfg) {
        return value.value ? OpenClosedType.CLOSED : OpenClosedType.OPEN;
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIndustrialCounterValue1Getter0(BrickletIndustrialCounter.SignalData value, BrickletIndustrialCounterConfig cfg) {
        return value.value ? OpenClosedType.CLOSED : OpenClosedType.OPEN;
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIndustrialCounterValue2Getter0(BrickletIndustrialCounter.SignalData value, BrickletIndustrialCounterConfig cfg) {
        return value.value ? OpenClosedType.CLOSED : OpenClosedType.OPEN;
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIndustrialCounterValue3Getter0(BrickletIndustrialCounter.SignalData value, BrickletIndustrialCounterConfig cfg) {
        return value.value ? OpenClosedType.CLOSED : OpenClosedType.OPEN;
    }

}