/**
 * 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.OnOffType;

import com.tinkerforge.BrickletIMUV3;
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 IMU Bricklet 3.0.
 * @author Erik Fleckstein - Initial contribution
 */
@NonNullByDefault
public class BrickletIMUV3Wrapper extends BrickletIMUV3 implements CoMCUFlashable, DeviceWrapper {
    public static final DeviceInfo DEVICE_INFO = new DeviceInfo(BrickletIMUV3.DEVICE_DISPLAY_NAME, "brickletimuv3", BrickletIMUV3.DEVICE_IDENTIFIER, BrickletIMUV3Wrapper.class, BrickletIMUV3Actions.class, "2.0.0", true);

    public BrickletIMUV3Wrapper(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(BrickletIMUV3Wrapper.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);
        BrickletIMUV3Config cfg = (BrickletIMUV3Config) config.as(BrickletIMUV3Config.class);
        this.addAccelerationListener(this.reg((x, y, z) -> {if(true) {updateStateFn.accept("BrickletIMUV3AccelerationX", transformBrickletIMUV3AccelerationXCallback0(x, y, z, cfg));}}, this::removeAccelerationListener));
		this.addAccelerationListener(this.reg((x, y, z) -> {if(true) {updateStateFn.accept("BrickletIMUV3AccelerationY", transformBrickletIMUV3AccelerationYCallback0(x, y, z, cfg));}}, this::removeAccelerationListener));
		this.addAccelerationListener(this.reg((x, y, z) -> {if(true) {updateStateFn.accept("BrickletIMUV3AccelerationZ", transformBrickletIMUV3AccelerationZCallback0(x, y, z, cfg));}}, this::removeAccelerationListener));
		this.addMagneticFieldListener(this.reg((x, y, z) -> {if(true) {updateStateFn.accept("BrickletIMUV3MagneticFieldX", transformBrickletIMUV3MagneticFieldXCallback0(x, y, z, cfg));}}, this::removeMagneticFieldListener));
		this.addMagneticFieldListener(this.reg((x, y, z) -> {if(true) {updateStateFn.accept("BrickletIMUV3MagneticFieldY", transformBrickletIMUV3MagneticFieldYCallback0(x, y, z, cfg));}}, this::removeMagneticFieldListener));
		this.addMagneticFieldListener(this.reg((x, y, z) -> {if(true) {updateStateFn.accept("BrickletIMUV3MagneticFieldZ", transformBrickletIMUV3MagneticFieldZCallback0(x, y, z, cfg));}}, this::removeMagneticFieldListener));
		this.addAngularVelocityListener(this.reg((x, y, z) -> {if(true) {updateStateFn.accept("BrickletIMUV3AngularVelocityX", transformBrickletIMUV3AngularVelocityXCallback0(x, y, z, cfg));}}, this::removeAngularVelocityListener));
		this.addAngularVelocityListener(this.reg((x, y, z) -> {if(true) {updateStateFn.accept("BrickletIMUV3AngularVelocityY", transformBrickletIMUV3AngularVelocityYCallback0(x, y, z, cfg));}}, this::removeAngularVelocityListener));
		this.addAngularVelocityListener(this.reg((x, y, z) -> {if(true) {updateStateFn.accept("BrickletIMUV3AngularVelocityZ", transformBrickletIMUV3AngularVelocityZCallback0(x, y, z, cfg));}}, this::removeAngularVelocityListener));
		this.addOrientationListener(this.reg((heading, roll, pitch) -> {if(true) {updateStateFn.accept("BrickletIMUV3OrientationHeading", transformBrickletIMUV3OrientationHeadingCallback0(heading, roll, pitch, cfg));}}, this::removeOrientationListener));
		this.addOrientationListener(this.reg((heading, roll, pitch) -> {if(true) {updateStateFn.accept("BrickletIMUV3OrientationRoll", transformBrickletIMUV3OrientationRollCallback0(heading, roll, pitch, cfg));}}, this::removeOrientationListener));
		this.addOrientationListener(this.reg((heading, roll, pitch) -> {if(true) {updateStateFn.accept("BrickletIMUV3OrientationPitch", transformBrickletIMUV3OrientationPitchCallback0(heading, roll, pitch, cfg));}}, this::removeOrientationListener));
		this.addQuaternionListener(this.reg((w, x, y, z) -> {if(true) {updateStateFn.accept("BrickletIMUV3QuaternionW", transformBrickletIMUV3QuaternionWCallback0(w, x, y, z, cfg));}}, this::removeQuaternionListener));
		this.addQuaternionListener(this.reg((w, x, y, z) -> {if(true) {updateStateFn.accept("BrickletIMUV3QuaternionX", transformBrickletIMUV3QuaternionXCallback0(w, x, y, z, cfg));}}, this::removeQuaternionListener));
		this.addQuaternionListener(this.reg((w, x, y, z) -> {if(true) {updateStateFn.accept("BrickletIMUV3QuaternionY", transformBrickletIMUV3QuaternionYCallback0(w, x, y, z, cfg));}}, this::removeQuaternionListener));
		this.addQuaternionListener(this.reg((w, x, y, z) -> {if(true) {updateStateFn.accept("BrickletIMUV3QuaternionZ", transformBrickletIMUV3QuaternionZCallback0(w, x, y, z, cfg));}}, this::removeQuaternionListener));
		this.addLinearAccelerationListener(this.reg((x, y, z) -> {if(true) {updateStateFn.accept("BrickletIMUV3LinearAccelerationX", transformBrickletIMUV3LinearAccelerationXCallback0(x, y, z, cfg));}}, this::removeLinearAccelerationListener));
		this.addLinearAccelerationListener(this.reg((x, y, z) -> {if(true) {updateStateFn.accept("BrickletIMUV3LinearAccelerationY", transformBrickletIMUV3LinearAccelerationYCallback0(x, y, z, cfg));}}, this::removeLinearAccelerationListener));
		this.addLinearAccelerationListener(this.reg((x, y, z) -> {if(true) {updateStateFn.accept("BrickletIMUV3LinearAccelerationZ", transformBrickletIMUV3LinearAccelerationZCallback0(x, y, z, cfg));}}, this::removeLinearAccelerationListener));
		this.addGravityVectorListener(this.reg((x, y, z) -> {if(true) {updateStateFn.accept("BrickletIMUV3GravityVectorX", transformBrickletIMUV3GravityVectorXCallback0(x, y, z, cfg));}}, this::removeGravityVectorListener));
		this.addGravityVectorListener(this.reg((x, y, z) -> {if(true) {updateStateFn.accept("BrickletIMUV3GravityVectorY", transformBrickletIMUV3GravityVectorYCallback0(x, y, z, cfg));}}, this::removeGravityVectorListener));
		this.addGravityVectorListener(this.reg((x, y, z) -> {if(true) {updateStateFn.accept("BrickletIMUV3GravityVectorZ", transformBrickletIMUV3GravityVectorZCallback0(x, y, z, cfg));}}, this::removeGravityVectorListener));
		this.addTemperatureListener(this.reg((temperature) -> {if(true) {updateStateFn.accept("BrickletIMUV3Temperature", transformBrickletIMUV3TemperatureCallback0(temperature, cfg));}}, this::removeTemperatureListener));
        
		    this.setAccelerationCallbackConfiguration(cfg.accelerationUpdateInterval, true);
		    this.setMagneticFieldCallbackConfiguration(cfg.magneticFieldUpdateInterval, true);
		    this.setAngularVelocityCallbackConfiguration(cfg.angularVelocityUpdateInterval, true);
		    this.setOrientationCallbackConfiguration(cfg.orientationUpdateInterval, true);
		    this.setQuaternionCallbackConfiguration(cfg.quaternionUpdateInterval, true);
		    this.setLinearAccelerationCallbackConfiguration(cfg.linearAccelerationUpdateInterval, true);
		    this.setGravityVectorCallbackConfiguration(cfg.gravityVectorUpdateInterval, true);
		    this.setTemperatureCallbackConfiguration(cfg.temperatureUpdateInterval, true);
		    this.setSensorConfiguration(cfg.magnetometerRate.shortValue(), cfg.gyroscopeRange.shortValue(), cfg.gyroscopeBandwidth.shortValue(), cfg.accelerometerRange.shortValue(), cfg.accelerometerBandwidth.shortValue());
		    this.setSensorFusionMode(cfg.sensorFusionMode.shortValue());
		    
		this.setStatusLEDConfig(cfg.statusLEDConfig);
    }

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

        
        
    }

    @Override
    public List<String> getEnabledChannels(org.eclipse.smarthome.config.core.Configuration config) throws TinkerforgeException{
        List<String> result = new ArrayList<String>();
        result.add("BrickletIMUV3AccelerationX");
		result.add("BrickletIMUV3AccelerationY");
		result.add("BrickletIMUV3AccelerationZ");
		result.add("BrickletIMUV3MagneticFieldX");
		result.add("BrickletIMUV3MagneticFieldY");
		result.add("BrickletIMUV3MagneticFieldZ");
		result.add("BrickletIMUV3AngularVelocityX");
		result.add("BrickletIMUV3AngularVelocityY");
		result.add("BrickletIMUV3AngularVelocityZ");
		result.add("BrickletIMUV3OrientationHeading");
		result.add("BrickletIMUV3OrientationRoll");
		result.add("BrickletIMUV3OrientationPitch");
		result.add("BrickletIMUV3QuaternionW");
		result.add("BrickletIMUV3QuaternionX");
		result.add("BrickletIMUV3QuaternionY");
		result.add("BrickletIMUV3QuaternionZ");
		result.add("BrickletIMUV3LinearAccelerationX");
		result.add("BrickletIMUV3LinearAccelerationY");
		result.add("BrickletIMUV3LinearAccelerationZ");
		result.add("BrickletIMUV3GravityVectorX");
		result.add("BrickletIMUV3GravityVectorY");
		result.add("BrickletIMUV3GravityVectorZ");
		result.add("BrickletIMUV3Temperature");
        return result;
    }

    public static @Nullable ChannelType getChannelType(ChannelTypeUID channelTypeUID) {
        switch(channelTypeUID.getId()) {
            case "BrickletIMUV3Acceleration":
                return ChannelTypeBuilder.state(new ChannelTypeUID("tinkerforge", "BrickletIMUV3Acceleration"), "NOT USED", "Number:Acceleration").withConfigDescriptionURI(URI.create("channel-type:tinkerforge:BrickletIMUV3Acceleration")).withDescription("The acceleration from the accelerometer for the x, y and z axis in m/s².")
.withStateDescription(StateDescriptionFragmentBuilder.create().withPattern("%.2f %unit%").withReadOnly(true).build().toStateDescription()).build();
            case "BrickletIMUV3MagneticField":
                return ChannelTypeBuilder.state(new ChannelTypeUID("tinkerforge", "BrickletIMUV3MagneticField"), "NOT USED", "Number:MagneticFluxDensity").withConfigDescriptionURI(URI.create("channel-type:tinkerforge:BrickletIMUV3MagneticField")).withDescription("The calibrated magnetic field from the magnetometer for the x, y and z axis in Tesla.")
.withStateDescription(StateDescriptionFragmentBuilder.create().withMinimum(BigDecimal.valueOf(-0.0025)).withMaximum(BigDecimal.valueOf(0.0025)).withStep(BigDecimal.valueOf(6.25e-08)).withPattern("%.8f %unit%").withReadOnly(true).build().toStateDescription()).build();
            case "BrickletIMUV3AngularVelocity":
                return ChannelTypeBuilder.state(new ChannelTypeUID("tinkerforge", "BrickletIMUV3AngularVelocity"), "NOT USED", "Number:Dimensionless").withConfigDescriptionURI(URI.create("channel-type:tinkerforge:BrickletIMUV3AngularVelocity")).withDescription("The calibrated angular velocity from the gyroscope for the x, y and z axis in °/s.")
.withStateDescription(StateDescriptionFragmentBuilder.create().withPattern("%.2f").withReadOnly(true).build().toStateDescription()).build();
            case "BrickletIMUV3Orientation":
                return ChannelTypeBuilder.state(new ChannelTypeUID("tinkerforge", "BrickletIMUV3Orientation"), "NOT USED", "Number:Angle").withConfigDescriptionURI(URI.create("channel-type:tinkerforge:BrickletIMUV3Orientation")).withDescription("The current orientation (heading, roll, pitch) of the IMU Brick as independent Euler angles in 1/16 degree. Note that Euler angles always experience a gimbal lock. We recommend that you use quaternions instead, if you need the absolute orientation.")
.withStateDescription(StateDescriptionFragmentBuilder.create().withMinimum(BigDecimal.valueOf(-180)).withMaximum(BigDecimal.valueOf(360)).withStep(BigDecimal.valueOf(0.0625)).withPattern("%.2f %unit%").withReadOnly(true).build().toStateDescription()).build();
            case "BrickletIMUV3Quaternion":
                return ChannelTypeBuilder.state(new ChannelTypeUID("tinkerforge", "BrickletIMUV3Quaternion"), "NOT USED", "Number:Dimensionless").withConfigDescriptionURI(URI.create("channel-type:tinkerforge:BrickletIMUV3Quaternion")).withDescription("The current orientation (w, x, y, z) of the IMU Brick as quaternions.")
.withStateDescription(StateDescriptionFragmentBuilder.create().withMinimum(BigDecimal.valueOf(-1)).withMaximum(BigDecimal.valueOf(1)).withStep(BigDecimal.valueOf(6.103888176768602e-05)).withPattern("%.5f").withReadOnly(true).build().toStateDescription()).build();
            case "BrickletIMUV3LinearAcceleration":
                return ChannelTypeBuilder.state(new ChannelTypeUID("tinkerforge", "BrickletIMUV3LinearAcceleration"), "NOT USED", "Number:Acceleration").withConfigDescriptionURI(URI.create("channel-type:tinkerforge:BrickletIMUV3LinearAcceleration")).withDescription("The linear acceleration from the accelerometer for the x, y and z axis in m/s. The linear acceleration is the acceleration in each of the three axis of the IMU Brick with the influences of gravity removed.")
.withStateDescription(StateDescriptionFragmentBuilder.create().withPattern("%.2f %unit%").withReadOnly(true).build().toStateDescription()).build();
            case "BrickletIMUV3GravityVector":
                return ChannelTypeBuilder.state(new ChannelTypeUID("tinkerforge", "BrickletIMUV3GravityVector"), "NOT USED", "Number:Acceleration").withConfigDescriptionURI(URI.create("channel-type:tinkerforge:BrickletIMUV3GravityVector")).withDescription("The current gravity vector of the IMU Brick for the x, y and z axis in g (1g = 9.80665m/s²). The gravity vector is the acceleration that occurs due to gravity. Influences of additional linear acceleration are removed.")
.withStateDescription(StateDescriptionFragmentBuilder.create().withMinimum(BigDecimal.valueOf(-1.0003416049313476)).withMaximum(BigDecimal.valueOf(1.0003416049313476)).withStep(BigDecimal.valueOf(0.0010197162129779282)).withPattern("%.3f %unit%").withReadOnly(true).build().toStateDescription()).build();
            case "BrickletIMUV3Temperature":
                return ChannelTypeBuilder.state(new ChannelTypeUID("tinkerforge", "BrickletIMUV3Temperature"), "NOT USED", "Number:Temperature").withConfigDescriptionURI(URI.create("channel-type:tinkerforge:BrickletIMUV3Temperature")).withDescription("The temperature of the IMU Brick. The temperature is given in °C. The temperature is measured in the core of the BNO055 IC, it is not the ambient temperature.")
.withStateDescription(StateDescriptionFragmentBuilder.create().withPattern("%d %unit%").withReadOnly(true).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 IMU Bricklet 3.0").isListed(false).withSupportedBridgeTypeUIDs(Arrays.asList(TinkerforgeBindingConstants.THING_TYPE_BRICK_DAEMON.toString())).withConfigDescriptionURI(URI.create("thing-type:tinkerforge:" + thingTypeUID.getId())).withDescription("Full fledged AHRS with 9 degrees of freedom").withChannelDefinitions(Arrays.asList(new ChannelDefinitionBuilder("BrickletIMUV3AccelerationX", new ChannelTypeUID("tinkerforge", "BrickletIMUV3Acceleration")).withLabel("Acceleration - X").build(), new ChannelDefinitionBuilder("BrickletIMUV3AccelerationY", new ChannelTypeUID("tinkerforge", "BrickletIMUV3Acceleration")).withLabel("Acceleration - Y").build(), new ChannelDefinitionBuilder("BrickletIMUV3AccelerationZ", new ChannelTypeUID("tinkerforge", "BrickletIMUV3Acceleration")).withLabel("Acceleration - Z").build(), new ChannelDefinitionBuilder("BrickletIMUV3MagneticFieldX", new ChannelTypeUID("tinkerforge", "BrickletIMUV3MagneticField")).withLabel("Magnetic Field - X").build(), new ChannelDefinitionBuilder("BrickletIMUV3MagneticFieldY", new ChannelTypeUID("tinkerforge", "BrickletIMUV3MagneticField")).withLabel("Magnetic Field - Y").build(), new ChannelDefinitionBuilder("BrickletIMUV3MagneticFieldZ", new ChannelTypeUID("tinkerforge", "BrickletIMUV3MagneticField")).withLabel("Magnetic Field - Z").build(), new ChannelDefinitionBuilder("BrickletIMUV3AngularVelocityX", new ChannelTypeUID("tinkerforge", "BrickletIMUV3AngularVelocity")).withLabel("Angular Velocity - X").build(), new ChannelDefinitionBuilder("BrickletIMUV3AngularVelocityY", new ChannelTypeUID("tinkerforge", "BrickletIMUV3AngularVelocity")).withLabel("Angular Velocity - Y").build(), new ChannelDefinitionBuilder("BrickletIMUV3AngularVelocityZ", new ChannelTypeUID("tinkerforge", "BrickletIMUV3AngularVelocity")).withLabel("Angular Velocity - Z").build(), new ChannelDefinitionBuilder("BrickletIMUV3OrientationHeading", new ChannelTypeUID("tinkerforge", "BrickletIMUV3Orientation")).withLabel("Orientation - Heading").build(), new ChannelDefinitionBuilder("BrickletIMUV3OrientationRoll", new ChannelTypeUID("tinkerforge", "BrickletIMUV3Orientation")).withLabel("Orientation - Roll").build(), new ChannelDefinitionBuilder("BrickletIMUV3OrientationPitch", new ChannelTypeUID("tinkerforge", "BrickletIMUV3Orientation")).withLabel("Orientation - Pitch").build(), new ChannelDefinitionBuilder("BrickletIMUV3QuaternionW", new ChannelTypeUID("tinkerforge", "BrickletIMUV3Quaternion")).withLabel("Quaternion - W").build(), new ChannelDefinitionBuilder("BrickletIMUV3QuaternionX", new ChannelTypeUID("tinkerforge", "BrickletIMUV3Quaternion")).withLabel("Quaternion - X").build(), new ChannelDefinitionBuilder("BrickletIMUV3QuaternionY", new ChannelTypeUID("tinkerforge", "BrickletIMUV3Quaternion")).withLabel("Quaternion - Y").build(), new ChannelDefinitionBuilder("BrickletIMUV3QuaternionZ", new ChannelTypeUID("tinkerforge", "BrickletIMUV3Quaternion")).withLabel("Quaternion - Z").build(), new ChannelDefinitionBuilder("BrickletIMUV3LinearAccelerationX", new ChannelTypeUID("tinkerforge", "BrickletIMUV3LinearAcceleration")).withLabel("Linear Acceleration - X").build(), new ChannelDefinitionBuilder("BrickletIMUV3LinearAccelerationY", new ChannelTypeUID("tinkerforge", "BrickletIMUV3LinearAcceleration")).withLabel("Linear Acceleration - Y").build(), new ChannelDefinitionBuilder("BrickletIMUV3LinearAccelerationZ", new ChannelTypeUID("tinkerforge", "BrickletIMUV3LinearAcceleration")).withLabel("Linear Acceleration - Z").build(), new ChannelDefinitionBuilder("BrickletIMUV3GravityVectorX", new ChannelTypeUID("tinkerforge", "BrickletIMUV3GravityVector")).withLabel("Gravity Vector - X").build(), new ChannelDefinitionBuilder("BrickletIMUV3GravityVectorY", new ChannelTypeUID("tinkerforge", "BrickletIMUV3GravityVector")).withLabel("Gravity Vector - Y").build(), new ChannelDefinitionBuilder("BrickletIMUV3GravityVectorZ", new ChannelTypeUID("tinkerforge", "BrickletIMUV3GravityVector")).withLabel("Gravity Vector - Z").build(), new ChannelDefinitionBuilder("BrickletIMUV3Temperature", new ChannelTypeUID("tinkerforge", "BrickletIMUV3Temperature")).withLabel("Temperature").build())).withProperties(props).build();
    }

    public static @Nullable ConfigDescription getConfigDescription(URI uri) {
        switch(uri.toASCIIString()) {
            case "thing-type:tinkerforge:brickletimuv3":
                return ConfigDescriptionBuilder.create(uri).withParameters(Arrays.asList(ConfigDescriptionParameterBuilder.create("magnetometerRate", Type.INTEGER).withDefault("5").withDescription("This option is auto-controlled in fusion mode.").withLabel("Magnetometer Rate").withAdvanced(true).withLimitToOptions(true).withOptions(Arrays.asList(new ParameterOption("0", "2Hz"), new ParameterOption("1", "6Hz"), new ParameterOption("2", "8Hz"), new ParameterOption("3", "10Hz"), new ParameterOption("4", "15Hz"), new ParameterOption("5", "20Hz"), new ParameterOption("6", "25Hz"), new ParameterOption("7", "30Hz"))).build(), ConfigDescriptionParameterBuilder.create("gyroscopeRange", Type.INTEGER).withDefault("0").withDescription("This option is auto-controlled in fusion mode.").withLabel("Gyroscope Range").withAdvanced(true).withLimitToOptions(true).withOptions(Arrays.asList(new ParameterOption("0", "2000°/s"), new ParameterOption("1", "1000°/s"), new ParameterOption("2", "500°/s"), new ParameterOption("3", "250°/s"), new ParameterOption("4", "125°/s"))).build(), ConfigDescriptionParameterBuilder.create("gyroscopeBandwidth", Type.INTEGER).withDefault("7").withDescription("This option is auto-controlled in fusion mode.").withLabel("Gyroscope Bandwidth").withAdvanced(true).withLimitToOptions(true).withOptions(Arrays.asList(new ParameterOption("0", "523Hz"), new ParameterOption("1", "230Hz"), new ParameterOption("2", "116Hz"), new ParameterOption("3", "47Hz"), new ParameterOption("4", "23Hz"), new ParameterOption("5", "12Hz"), new ParameterOption("6", "64Hz"), new ParameterOption("7", "32Hz"))).build(), ConfigDescriptionParameterBuilder.create("accelerometerRange", Type.INTEGER).withDefault("1").withDescription("This option is user selectable in all fusion modes.").withLabel("Accelerometer Range").withAdvanced(true).withLimitToOptions(true).withOptions(Arrays.asList(new ParameterOption("0", "±2G"), new ParameterOption("1", "±4G"), new ParameterOption("2", "±8G"), new ParameterOption("3", "±16G"))).build(), ConfigDescriptionParameterBuilder.create("accelerometerBandwidth", Type.INTEGER).withDefault("3").withDescription("This option is auto-controlled in fusion mode.").withLabel("Accelerometer Bandwidth").withAdvanced(true).withLimitToOptions(true).withOptions(Arrays.asList(new ParameterOption("0", "7.81Hz"), new ParameterOption("1", "15.63Hz"), new ParameterOption("2", "31.25Hz"), new ParameterOption("3", "62.5Hz"), new ParameterOption("4", "125Hz"), new ParameterOption("5", "250Hz"), new ParameterOption("6", "500Hz"), new ParameterOption("7", "1000Hz"))).build(), ConfigDescriptionParameterBuilder.create("sensorFusionMode", Type.INTEGER).withDefault("1").withDescription("If the fusion mode is turned off, the Acceleration, Magnetic Field and Angular Velocity channels return uncalibrated and uncompensated sensor data. All other sensor channels return no data.<br/><br/>Since firmware version 2.0.6 you can also use a fusion mode without magnetometer. In this mode the calculated orientation is relative (with magnetometer it is absolute with respect to the earth). However, the calculation can't be influenced by spurious magnetic fields.<br/><br/>Since firmware version 2.0.13 you can also use a fusion mode without fast magnetometer calibration. This mode is the same as the normal fusion mode, but the fast magnetometer calibration is turned off. So to find the orientation the first time will likely take longer, but small magnetic influences might not affect the automatic calibration as much.<br/><br/>By default sensor fusion is on.").withLabel("Sensor Fusion Mode").withAdvanced(true).withLimitToOptions(true).withOptions(Arrays.asList(new ParameterOption("0", "Off"), new ParameterOption("1", "On"), new ParameterOption("2", "On Without Magnetometer"), new ParameterOption("3", "On Without Fast Magnetometer Calibration"))).build(), ConfigDescriptionParameterBuilder.create("accelerationUpdateInterval", Type.INTEGER).withDefault("1000").withDescription("Specifies the update interval for the acceleration in milliseconds. A value of 0 disables automatic updates.").withGroupName("update_intervals").withLabel("Acceleration Update Interval").withUnit("ms").withMinimum(BigDecimal.valueOf(0)).withMaximum(BigDecimal.valueOf(4294967295L)).build(), ConfigDescriptionParameterBuilder.create("magneticFieldUpdateInterval", Type.INTEGER).withDefault("1000").withDescription("Specifies the update interval for the magnetic field in milliseconds. A value of 0 disables automatic updates.").withGroupName("update_intervals").withLabel("Magnetic Field Update Interval").withUnit("ms").withMinimum(BigDecimal.valueOf(0)).withMaximum(BigDecimal.valueOf(4294967295L)).build(), ConfigDescriptionParameterBuilder.create("angularVelocityUpdateInterval", Type.INTEGER).withDefault("1000").withDescription("Specifies the update interval for the angular velocity in milliseconds. A value of 0 disables automatic updates.").withGroupName("update_intervals").withLabel("Angular Velocity Update Interval").withUnit("ms").withMinimum(BigDecimal.valueOf(0)).withMaximum(BigDecimal.valueOf(4294967295L)).build(), ConfigDescriptionParameterBuilder.create("orientationUpdateInterval", Type.INTEGER).withDefault("1000").withDescription("Specifies the update interval for the orientation as euler angles in milliseconds. A value of 0 disables automatic updates.").withGroupName("update_intervals").withLabel("Orientation Update Interval").withUnit("ms").withMinimum(BigDecimal.valueOf(0)).withMaximum(BigDecimal.valueOf(4294967295L)).build(), ConfigDescriptionParameterBuilder.create("quaternionUpdateInterval", Type.INTEGER).withDefault("1000").withDescription("Specifies the update interval for the orientation as quaternion in milliseconds. A value of 0 disables automatic updates.").withGroupName("update_intervals").withLabel("Quaternion Update Interval").withUnit("ms").withMinimum(BigDecimal.valueOf(0)).withMaximum(BigDecimal.valueOf(4294967295L)).build(), ConfigDescriptionParameterBuilder.create("linearAccelerationUpdateInterval", Type.INTEGER).withDefault("1000").withDescription("Specifies the update interval for the linear acceleration in milliseconds. A value of 0 disables automatic updates.").withGroupName("update_intervals").withLabel("Linear Acceleration Update Interval").withUnit("ms").withMinimum(BigDecimal.valueOf(0)).withMaximum(BigDecimal.valueOf(4294967295L)).build(), ConfigDescriptionParameterBuilder.create("gravityVectorUpdateInterval", Type.INTEGER).withDefault("1000").withDescription("Specifies the update interval for the gravity vector in milliseconds. A value of 0 disables automatic updates.").withGroupName("update_intervals").withLabel("Gravity Vector Update Interval").withUnit("ms").withMinimum(BigDecimal.valueOf(0)).withMaximum(BigDecimal.valueOf(4294967295L)).build(), ConfigDescriptionParameterBuilder.create("temperatureUpdateInterval", Type.INTEGER).withDefault("1000").withDescription("Specifies the update interval for the temperature in milliseconds. A value of 0 disables automatic updates.").withGroupName("update_intervals").withLabel("Temperature 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(new ConfigDescriptionParameterGroup("update_intervals", "null", true, "Update Intervals", "Update Intervals"))).build();
            case "channel-type:tinkerforge:BrickletIMUV3Acceleration":
                return ConfigDescriptionBuilder.create(uri).withParameters(Arrays.asList()).withParameterGroups(Arrays.asList()).build();
            case "channel-type:tinkerforge:BrickletIMUV3MagneticField":
                return ConfigDescriptionBuilder.create(uri).withParameters(Arrays.asList()).withParameterGroups(Arrays.asList()).build();
            case "channel-type:tinkerforge:BrickletIMUV3AngularVelocity":
                return ConfigDescriptionBuilder.create(uri).withParameters(Arrays.asList()).withParameterGroups(Arrays.asList()).build();
            case "channel-type:tinkerforge:BrickletIMUV3Orientation":
                return ConfigDescriptionBuilder.create(uri).withParameters(Arrays.asList()).withParameterGroups(Arrays.asList()).build();
            case "channel-type:tinkerforge:BrickletIMUV3Quaternion":
                return ConfigDescriptionBuilder.create(uri).withParameters(Arrays.asList()).withParameterGroups(Arrays.asList()).build();
            case "channel-type:tinkerforge:BrickletIMUV3LinearAcceleration":
                return ConfigDescriptionBuilder.create(uri).withParameters(Arrays.asList()).withParameterGroups(Arrays.asList()).build();
            case "channel-type:tinkerforge:BrickletIMUV3GravityVector":
                return ConfigDescriptionBuilder.create(uri).withParameters(Arrays.asList()).withParameterGroups(Arrays.asList()).build();
            case "channel-type:tinkerforge:BrickletIMUV3Temperature":
                return ConfigDescriptionBuilder.create(uri).withParameters(Arrays.asList()).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 {
        BrickletIMUV3Config cfg = (BrickletIMUV3Config) config.as(BrickletIMUV3Config.class);
switch(channel) {
            case "BrickletIMUV3AccelerationX":
                   {
            BrickletIMUV3.Acceleration value = this.getAcceleration();
            if(true)
                updateStateFn.accept(channel, transformBrickletIMUV3AccelerationXGetter0(value, cfg));
        }
                   return;
            case "BrickletIMUV3AccelerationY":
                   {
            BrickletIMUV3.Acceleration value = this.getAcceleration();
            if(true)
                updateStateFn.accept(channel, transformBrickletIMUV3AccelerationYGetter0(value, cfg));
        }
                   return;
            case "BrickletIMUV3AccelerationZ":
                   {
            BrickletIMUV3.Acceleration value = this.getAcceleration();
            if(true)
                updateStateFn.accept(channel, transformBrickletIMUV3AccelerationZGetter0(value, cfg));
        }
                   return;
            case "BrickletIMUV3MagneticFieldX":
                   {
            BrickletIMUV3.MagneticField value = this.getMagneticField();
            if(true)
                updateStateFn.accept(channel, transformBrickletIMUV3MagneticFieldXGetter0(value, cfg));
        }
                   return;
            case "BrickletIMUV3MagneticFieldY":
                   {
            BrickletIMUV3.MagneticField value = this.getMagneticField();
            if(true)
                updateStateFn.accept(channel, transformBrickletIMUV3MagneticFieldYGetter0(value, cfg));
        }
                   return;
            case "BrickletIMUV3MagneticFieldZ":
                   {
            BrickletIMUV3.MagneticField value = this.getMagneticField();
            if(true)
                updateStateFn.accept(channel, transformBrickletIMUV3MagneticFieldZGetter0(value, cfg));
        }
                   return;
            case "BrickletIMUV3AngularVelocityX":
                   {
            BrickletIMUV3.AngularVelocity value = this.getAngularVelocity();
            if(true)
                updateStateFn.accept(channel, transformBrickletIMUV3AngularVelocityXGetter0(value, cfg));
        }
                   return;
            case "BrickletIMUV3AngularVelocityY":
                   {
            BrickletIMUV3.AngularVelocity value = this.getAngularVelocity();
            if(true)
                updateStateFn.accept(channel, transformBrickletIMUV3AngularVelocityYGetter0(value, cfg));
        }
                   return;
            case "BrickletIMUV3AngularVelocityZ":
                   {
            BrickletIMUV3.AngularVelocity value = this.getAngularVelocity();
            if(true)
                updateStateFn.accept(channel, transformBrickletIMUV3AngularVelocityZGetter0(value, cfg));
        }
                   return;
            case "BrickletIMUV3OrientationHeading":
                   {
            BrickletIMUV3.Orientation value = this.getOrientation();
            if(true)
                updateStateFn.accept(channel, transformBrickletIMUV3OrientationHeadingGetter0(value, cfg));
        }
                   return;
            case "BrickletIMUV3OrientationRoll":
                   {
            BrickletIMUV3.Orientation value = this.getOrientation();
            if(true)
                updateStateFn.accept(channel, transformBrickletIMUV3OrientationRollGetter0(value, cfg));
        }
                   return;
            case "BrickletIMUV3OrientationPitch":
                   {
            BrickletIMUV3.Orientation value = this.getOrientation();
            if(true)
                updateStateFn.accept(channel, transformBrickletIMUV3OrientationPitchGetter0(value, cfg));
        }
                   return;
            case "BrickletIMUV3QuaternionW":
                   {
            BrickletIMUV3.Quaternion value = this.getQuaternion();
            if(true)
                updateStateFn.accept(channel, transformBrickletIMUV3QuaternionWGetter0(value, cfg));
        }
                   return;
            case "BrickletIMUV3QuaternionX":
                   {
            BrickletIMUV3.Quaternion value = this.getQuaternion();
            if(true)
                updateStateFn.accept(channel, transformBrickletIMUV3QuaternionXGetter0(value, cfg));
        }
                   return;
            case "BrickletIMUV3QuaternionY":
                   {
            BrickletIMUV3.Quaternion value = this.getQuaternion();
            if(true)
                updateStateFn.accept(channel, transformBrickletIMUV3QuaternionYGetter0(value, cfg));
        }
                   return;
            case "BrickletIMUV3QuaternionZ":
                   {
            BrickletIMUV3.Quaternion value = this.getQuaternion();
            if(true)
                updateStateFn.accept(channel, transformBrickletIMUV3QuaternionZGetter0(value, cfg));
        }
                   return;
            case "BrickletIMUV3LinearAccelerationX":
                   {
            BrickletIMUV3.LinearAcceleration value = this.getLinearAcceleration();
            if(true)
                updateStateFn.accept(channel, transformBrickletIMUV3LinearAccelerationXGetter0(value, cfg));
        }
                   return;
            case "BrickletIMUV3LinearAccelerationY":
                   {
            BrickletIMUV3.LinearAcceleration value = this.getLinearAcceleration();
            if(true)
                updateStateFn.accept(channel, transformBrickletIMUV3LinearAccelerationYGetter0(value, cfg));
        }
                   return;
            case "BrickletIMUV3LinearAccelerationZ":
                   {
            BrickletIMUV3.LinearAcceleration value = this.getLinearAcceleration();
            if(true)
                updateStateFn.accept(channel, transformBrickletIMUV3LinearAccelerationZGetter0(value, cfg));
        }
                   return;
            case "BrickletIMUV3GravityVectorX":
                   {
            BrickletIMUV3.GravityVector value = this.getGravityVector();
            if(true)
                updateStateFn.accept(channel, transformBrickletIMUV3GravityVectorXGetter0(value, cfg));
        }
                   return;
            case "BrickletIMUV3GravityVectorY":
                   {
            BrickletIMUV3.GravityVector value = this.getGravityVector();
            if(true)
                updateStateFn.accept(channel, transformBrickletIMUV3GravityVectorYGetter0(value, cfg));
        }
                   return;
            case "BrickletIMUV3GravityVectorZ":
                   {
            BrickletIMUV3.GravityVector value = this.getGravityVector();
            if(true)
                updateStateFn.accept(channel, transformBrickletIMUV3GravityVectorZGetter0(value, cfg));
        }
                   return;
            case "BrickletIMUV3Temperature":
                   {
            int value = this.getTemperature();
            if(true)
                updateStateFn.accept(channel, transformBrickletIMUV3TemperatureGetter0(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) {
            default:
                logger.warn("Command for unknown channel {}", channel);
        }
        return result;
    }

        private org.eclipse.smarthome.core.types.State transformBrickletIMUV3AccelerationXCallback0(int x, int y, int z, BrickletIMUV3Config cfg) {
        return new QuantityType<>(x / 100.0, SmartHomeUnits.METRE_PER_SQUARE_SECOND);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIMUV3AccelerationYCallback0(int x, int y, int z, BrickletIMUV3Config cfg) {
        return new QuantityType<>(y / 100.0, SmartHomeUnits.METRE_PER_SQUARE_SECOND);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIMUV3AccelerationZCallback0(int x, int y, int z, BrickletIMUV3Config cfg) {
        return new QuantityType<>(z / 100.0, SmartHomeUnits.METRE_PER_SQUARE_SECOND);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIMUV3MagneticFieldXCallback0(int x, int y, int z, BrickletIMUV3Config cfg) {
        return new QuantityType<>(x / 16000000.0, SmartHomeUnits.TESLA);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIMUV3MagneticFieldYCallback0(int x, int y, int z, BrickletIMUV3Config cfg) {
        return new QuantityType<>(y / 16000000.0, SmartHomeUnits.TESLA);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIMUV3MagneticFieldZCallback0(int x, int y, int z, BrickletIMUV3Config cfg) {
        return new QuantityType<>(z / 16000000.0, SmartHomeUnits.TESLA);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIMUV3AngularVelocityXCallback0(int x, int y, int z, BrickletIMUV3Config cfg) {
        return new DecimalType(x / 16.0);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIMUV3AngularVelocityYCallback0(int x, int y, int z, BrickletIMUV3Config cfg) {
        return new DecimalType(y / 16.0);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIMUV3AngularVelocityZCallback0(int x, int y, int z, BrickletIMUV3Config cfg) {
        return new DecimalType(z / 16.0);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIMUV3OrientationHeadingCallback0(int heading, int roll, int pitch, BrickletIMUV3Config cfg) {
        return new QuantityType<>(heading / 16.0, SmartHomeUnits.DEGREE_ANGLE);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIMUV3OrientationRollCallback0(int heading, int roll, int pitch, BrickletIMUV3Config cfg) {
        return new QuantityType<>(roll / 16.0, SmartHomeUnits.DEGREE_ANGLE);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIMUV3OrientationPitchCallback0(int heading, int roll, int pitch, BrickletIMUV3Config cfg) {
        return new QuantityType<>(pitch / 16.0, SmartHomeUnits.DEGREE_ANGLE);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIMUV3QuaternionWCallback0(int w, int x, int y, int z, BrickletIMUV3Config cfg) {
        return new DecimalType(w / 16383.0);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIMUV3QuaternionXCallback0(int w, int x, int y, int z, BrickletIMUV3Config cfg) {
        return new DecimalType(x / 16383.0);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIMUV3QuaternionYCallback0(int w, int x, int y, int z, BrickletIMUV3Config cfg) {
        return new DecimalType(y / 16383.0);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIMUV3QuaternionZCallback0(int w, int x, int y, int z, BrickletIMUV3Config cfg) {
        return new DecimalType(z / 16383.0);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIMUV3LinearAccelerationXCallback0(int x, int y, int z, BrickletIMUV3Config cfg) {
        return new QuantityType<>(x / 100.0, SmartHomeUnits.METRE_PER_SQUARE_SECOND);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIMUV3LinearAccelerationYCallback0(int x, int y, int z, BrickletIMUV3Config cfg) {
        return new QuantityType<>(y / 100.0, SmartHomeUnits.METRE_PER_SQUARE_SECOND);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIMUV3LinearAccelerationZCallback0(int x, int y, int z, BrickletIMUV3Config cfg) {
        return new QuantityType<>(z / 100.0, SmartHomeUnits.METRE_PER_SQUARE_SECOND);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIMUV3GravityVectorXCallback0(int x, int y, int z, BrickletIMUV3Config cfg) {
        return new QuantityType<>(x / 980.665, SmartHomeUnits.STANDARD_GRAVITY);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIMUV3GravityVectorYCallback0(int x, int y, int z, BrickletIMUV3Config cfg) {
        return new QuantityType<>(y / 980.665, SmartHomeUnits.STANDARD_GRAVITY);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIMUV3GravityVectorZCallback0(int x, int y, int z, BrickletIMUV3Config cfg) {
        return new QuantityType<>(z / 980.665, SmartHomeUnits.STANDARD_GRAVITY);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIMUV3TemperatureCallback0(int temperature, BrickletIMUV3Config cfg) {
        return new QuantityType<>(temperature, SIUnits.CELSIUS);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIMUV3AccelerationXGetter0(BrickletIMUV3.Acceleration value, BrickletIMUV3Config cfg) {
        return new QuantityType<>(value.x / 100.0, SmartHomeUnits.METRE_PER_SQUARE_SECOND);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIMUV3AccelerationYGetter0(BrickletIMUV3.Acceleration value, BrickletIMUV3Config cfg) {
        return new QuantityType<>(value.y / 100.0, SmartHomeUnits.METRE_PER_SQUARE_SECOND);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIMUV3AccelerationZGetter0(BrickletIMUV3.Acceleration value, BrickletIMUV3Config cfg) {
        return new QuantityType<>(value.z / 100.0, SmartHomeUnits.METRE_PER_SQUARE_SECOND);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIMUV3MagneticFieldXGetter0(BrickletIMUV3.MagneticField value, BrickletIMUV3Config cfg) {
        return new QuantityType<>(value.x / 16000000.0, SmartHomeUnits.TESLA);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIMUV3MagneticFieldYGetter0(BrickletIMUV3.MagneticField value, BrickletIMUV3Config cfg) {
        return new QuantityType<>(value.y / 16000000.0, SmartHomeUnits.TESLA);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIMUV3MagneticFieldZGetter0(BrickletIMUV3.MagneticField value, BrickletIMUV3Config cfg) {
        return new QuantityType<>(value.z / 16000000.0, SmartHomeUnits.TESLA);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIMUV3AngularVelocityXGetter0(BrickletIMUV3.AngularVelocity value, BrickletIMUV3Config cfg) {
        return new DecimalType(value.x / 16.0);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIMUV3AngularVelocityYGetter0(BrickletIMUV3.AngularVelocity value, BrickletIMUV3Config cfg) {
        return new DecimalType(value.y / 16.0);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIMUV3AngularVelocityZGetter0(BrickletIMUV3.AngularVelocity value, BrickletIMUV3Config cfg) {
        return new DecimalType(value.z / 16.0);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIMUV3OrientationHeadingGetter0(BrickletIMUV3.Orientation value, BrickletIMUV3Config cfg) {
        return new QuantityType<>(value.heading / 16.0, SmartHomeUnits.DEGREE_ANGLE);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIMUV3OrientationRollGetter0(BrickletIMUV3.Orientation value, BrickletIMUV3Config cfg) {
        return new QuantityType<>(value.roll / 16.0, SmartHomeUnits.DEGREE_ANGLE);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIMUV3OrientationPitchGetter0(BrickletIMUV3.Orientation value, BrickletIMUV3Config cfg) {
        return new QuantityType<>(value.pitch / 16.0, SmartHomeUnits.DEGREE_ANGLE);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIMUV3QuaternionWGetter0(BrickletIMUV3.Quaternion value, BrickletIMUV3Config cfg) {
        return new DecimalType(value.w / 16383.0);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIMUV3QuaternionXGetter0(BrickletIMUV3.Quaternion value, BrickletIMUV3Config cfg) {
        return new DecimalType(value.x / 16383.0);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIMUV3QuaternionYGetter0(BrickletIMUV3.Quaternion value, BrickletIMUV3Config cfg) {
        return new DecimalType(value.y / 16383.0);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIMUV3QuaternionZGetter0(BrickletIMUV3.Quaternion value, BrickletIMUV3Config cfg) {
        return new DecimalType(value.z / 16383.0);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIMUV3LinearAccelerationXGetter0(BrickletIMUV3.LinearAcceleration value, BrickletIMUV3Config cfg) {
        return new QuantityType<>(value.x / 100.0, SmartHomeUnits.METRE_PER_SQUARE_SECOND);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIMUV3LinearAccelerationYGetter0(BrickletIMUV3.LinearAcceleration value, BrickletIMUV3Config cfg) {
        return new QuantityType<>(value.y / 100.0, SmartHomeUnits.METRE_PER_SQUARE_SECOND);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIMUV3LinearAccelerationZGetter0(BrickletIMUV3.LinearAcceleration value, BrickletIMUV3Config cfg) {
        return new QuantityType<>(value.z / 100.0, SmartHomeUnits.METRE_PER_SQUARE_SECOND);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIMUV3GravityVectorXGetter0(BrickletIMUV3.GravityVector value, BrickletIMUV3Config cfg) {
        return new QuantityType<>(value.x / 980.665, SmartHomeUnits.STANDARD_GRAVITY);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIMUV3GravityVectorYGetter0(BrickletIMUV3.GravityVector value, BrickletIMUV3Config cfg) {
        return new QuantityType<>(value.y / 980.665, SmartHomeUnits.STANDARD_GRAVITY);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIMUV3GravityVectorZGetter0(BrickletIMUV3.GravityVector value, BrickletIMUV3Config cfg) {
        return new QuantityType<>(value.z / 980.665, SmartHomeUnits.STANDARD_GRAVITY);
    }
	    private org.eclipse.smarthome.core.types.State transformBrickletIMUV3TemperatureGetter0(int value, BrickletIMUV3Config cfg) {
        return new QuantityType<>(value, SIUnits.CELSIUS);
    }

}