gt:                 logger.debug("callbackPeriod {}", tfConfig.getCallbackPeriod());
context: /**
   * Copyright (c) 2010-2019 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
   */
  /**
   */
  package org.openhab.binding.tinkerforge.internal.model.impl;
  
  import java.lang.reflect.InvocationTargetException;
  import java.math.BigDecimal;
  import java.util.concurrent.atomic.AtomicBoolean;
  
  import org.eclipse.emf.common.notify.Notification;
  import org.eclipse.emf.common.notify.NotificationChain;
  import org.eclipse.emf.common.util.EList;
  import org.eclipse.emf.ecore.EClass;
  import org.eclipse.emf.ecore.InternalEObject;
  import org.eclipse.emf.ecore.impl.ENotificationImpl;
  import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
  import org.eclipse.emf.ecore.util.EcoreUtil;
  import org.openhab.binding.tinkerforge.internal.LoggerConstants;
  import org.openhab.binding.tinkerforge.internal.TinkerforgeErrorHandler;
  import org.openhab.binding.tinkerforge.internal.model.CallbackListener;
  import org.openhab.binding.tinkerforge.internal.model.IndustrialDualAnalogInChannel;
  import org.openhab.binding.tinkerforge.internal.model.MBaseDevice;
  import org.openhab.binding.tinkerforge.internal.model.MBrickletIndustrialDualAnalogIn;
  import org.openhab.binding.tinkerforge.internal.model.MSubDevice;
  import org.openhab.binding.tinkerforge.internal.model.MSubDeviceHolder;
  import org.openhab.binding.tinkerforge.internal.model.MTFConfigConsumer;
  import org.openhab.binding.tinkerforge.internal.model.ModelPackage;
  import org.openhab.binding.tinkerforge.internal.model.TFBaseConfiguration;
  import org.openhab.binding.tinkerforge.internal.tools.Tools;
  import org.openhab.binding.tinkerforge.internal.types.DecimalValue;
  import org.slf4j.Logger;
  import org.slf4j.LoggerFactory;
  
  import com.tinkerforge.BrickletIndustrialDualAnalogIn;
  import com.tinkerforge.NotConnectedException;
  import com.tinkerforge.TimeoutException;
  
  /**
   * <!-- begin-user-doc -->
   * An implementation of the model object '<em><b>Industrial Dual Analog In Channel</b></em>'.
   * <!-- end-user-doc -->
   * <p>
   * The following features are implemented:
   * </p>
   * <ul>
   * <li>{@link org.openhab.binding.tinkerforge.internal.model.impl.IndustrialDualAnalogInChannelImpl#getSensorValue
   * <em>Sensor Value</em>}</li>
   * <li>{@link org.openhab.binding.tinkerforge.internal.model.impl.IndustrialDualAnalogInChannelImpl#getLogger
   * <em>Logger</em>}</li>
   * <li>{@link org.openhab.binding.tinkerforge.internal.model.impl.IndustrialDualAnalogInChannelImpl#getUid <em>Uid</em>}
   * </li>
   * <li>{@link org.openhab.binding.tinkerforge.internal.model.impl.IndustrialDualAnalogInChannelImpl#isPoll
   * <em>Poll</em>}</li>
   * <li>{@link org.openhab.binding.tinkerforge.internal.model.impl.IndustrialDualAnalogInChannelImpl#getEnabledA
   * <em>Enabled A</em>}</li>
   * <li>{@link org.openhab.binding.tinkerforge.internal.model.impl.IndustrialDualAnalogInChannelImpl#getSubId <em>Sub
   * Id</em>}</li>
   * <li>{@link org.openhab.binding.tinkerforge.internal.model.impl.IndustrialDualAnalogInChannelImpl#getMbrick
   * <em>Mbrick</em>}</li>
   * <li>{@link org.openhab.binding.tinkerforge.internal.model.impl.IndustrialDualAnalogInChannelImpl#getTfConfig <em>Tf
   * Config</em>}</li>
   * <li>{@link org.openhab.binding.tinkerforge.internal.model.impl.IndustrialDualAnalogInChannelImpl#getCallbackPeriod
   * <em>Callback Period</em>}</li>
   * <li>{@link org.openhab.binding.tinkerforge.internal.model.impl.IndustrialDualAnalogInChannelImpl#getDeviceType
   * <em>Device Type</em>}</li>
   * <li>{@link org.openhab.binding.tinkerforge.internal.model.impl.IndustrialDualAnalogInChannelImpl#getThreshold
   * <em>Threshold</em>}</li>
   * <li>{@link org.openhab.binding.tinkerforge.internal.model.impl.IndustrialDualAnalogInChannelImpl#getChannelNum
   * <em>Channel Num</em>}</li>
   * </ul>
   *
   * @generated
   */
  public class IndustrialDualAnalogInChannelImpl extends MinimalEObjectImpl.Container
          implements IndustrialDualAnalogInChannel {
      /**
       * The cached value of the '{@link #getSensorValue() <em>Sensor Value</em>}' attribute.
       * <!-- begin-user-doc -->
       * <!-- end-user-doc -->
       * 
       * @see #getSensorValue()
       * @generated
       * @ordered
       */
      protected DecimalValue sensorValue;
  
      /**
       * The default value of the '{@link #getLogger() <em>Logger</em>}' attribute.
       * <!-- begin-user-doc -->
       * <!-- end-user-doc -->
       * 
       * @see #getLogger()
       * @generated
       * @ordered
       */
      protected static final Logger LOGGER_EDEFAULT = null;
  
      /**
       * The cached value of the '{@link #getLogger() <em>Logger</em>}' attribute.
       * <!-- begin-user-doc -->
       * <!-- end-user-doc -->
       * 
       * @see #getLogger()
       * @generated
       * @ordered
       */
      protected Logger logger = LOGGER_EDEFAULT;
  
      /**
       * The default value of the '{@link #getUid() <em>Uid</em>}' attribute.
       * <!-- begin-user-doc -->
       * <!-- end-user-doc -->
       * 
       * @see #getUid()
       * @generated
       * @ordered
       */
      protected static final String UID_EDEFAULT = null;
  
      /**
       * The cached value of the '{@link #getUid() <em>Uid</em>}' attribute.
       * <!-- begin-user-doc -->
       * <!-- end-user-doc -->
       * 
       * @see #getUid()
       * @generated
       * @ordered
       */
      protected String uid = UID_EDEFAULT;
  
      /**
       * The default value of the '{@link #isPoll() <em>Poll</em>}' attribute.
       * <!-- begin-user-doc -->
       * <!-- end-user-doc -->
       * 
       * @see #isPoll()
       * @generated
       * @ordered
       */
      protected static final boolean POLL_EDEFAULT = true;
  
      /**
       * The cached value of the '{@link #isPoll() <em>Poll</em>}' attribute.
       * <!-- begin-user-doc -->
       * <!-- end-user-doc -->
       * 
       * @see #isPoll()
       * @generated
       * @ordered
       */
      protected boolean poll = POLL_EDEFAULT;
  
      /**
       * The default value of the '{@link #getEnabledA() <em>Enabled A</em>}' attribute.
       * <!-- begin-user-doc -->
       * <!-- end-user-doc -->
       * 
       * @see #getEnabledA()
       * @generated
       * @ordered
       */
      protected static final AtomicBoolean ENABLED_A_EDEFAULT = null;
  
      /**
       * The cached value of the '{@link #getEnabledA() <em>Enabled A</em>}' attribute.
       * <!-- begin-user-doc -->
       * <!-- end-user-doc -->
       * 
       * @see #getEnabledA()
       * @generated
       * @ordered
       */
      protected AtomicBoolean enabledA = ENABLED_A_EDEFAULT;
  
      /**
       * The default value of the '{@link #getSubId() <em>Sub Id</em>}' attribute.
       * <!-- begin-user-doc -->
       * <!-- end-user-doc -->
       * 
       * @see #getSubId()
       * @generated
       * @ordered
       */
      protected static final String SUB_ID_EDEFAULT = null;
  
      /**
       * The cached value of the '{@link #getSubId() <em>Sub Id</em>}' attribute.
       * <!-- begin-user-doc -->
       * <!-- end-user-doc -->
       * 
       * @see #getSubId()
       * @generated
       * @ordered
       */
      protected String subId = SUB_ID_EDEFAULT;
  
      /**
       * The cached value of the '{@link #getTfConfig() <em>Tf Config</em>}' containment reference.
       * <!-- begin-user-doc -->
       * <!-- end-user-doc -->
       * 
       * @see #getTfConfig()
       * @generated
       * @ordered
       */
      protected TFBaseConfiguration tfConfig;
  
      /**
       * The default value of the '{@link #getCallbackPeriod() <em>Callback Period</em>}' attribute.
       * <!-- begin-user-doc -->
       * <!-- end-user-doc -->
       * 
       * @see #getCallbackPeriod()
       * @generated
       * @ordered
       */
      protected static final long CALLBACK_PERIOD_EDEFAULT = 1000L;
  
      /**
       * The cached value of the '{@link #getCallbackPeriod() <em>Callback Period</em>}' attribute.
       * <!-- begin-user-doc -->
       * <!-- end-user-doc -->
       * 
       * @see #getCallbackPeriod()
       * @generated
       * @ordered
       */
      protected long callbackPeriod = CALLBACK_PERIOD_EDEFAULT;
  
      /**
       * The default value of the '{@link #getDeviceType() <em>Device Type</em>}' attribute.
       * <!-- begin-user-doc -->
       * <!-- end-user-doc -->
       * 
       * @see #getDeviceType()
       * @generated
       * @ordered
       */
      protected static final String DEVICE_TYPE_EDEFAULT = "industrial_dual_analogin_channel";
  
      /**
       * The cached value of the '{@link #getDeviceType() <em>Device Type</em>}' attribute.
       * <!-- begin-user-doc -->
       * <!-- end-user-doc -->
       * 
       * @see #getDeviceType()
       * @generated
       * @ordered
       */
      protected String deviceType = DEVICE_TYPE_EDEFAULT;
  
      /**
       * The default value of the '{@link #getThreshold() <em>Threshold</em>}' attribute.
       * <!-- begin-user-doc -->
       * <!-- end-user-doc -->
       * 
       * @see #getThreshold()
       * @generated
       * @ordered
       */
      protected static final BigDecimal THRESHOLD_EDEFAULT = new BigDecimal("0");
  
      /**
       * The cached value of the '{@link #getThreshold() <em>Threshold</em>}' attribute.
       * <!-- begin-user-doc -->
       * <!-- end-user-doc -->
       * 
       * @see #getThreshold()
       * @generated
       * @ordered
       */
      protected BigDecimal threshold = THRESHOLD_EDEFAULT;
  
      /**
       * The default value of the '{@link #getChannelNum() <em>Channel Num</em>}' attribute.
       * <!-- begin-user-doc -->
       * <!-- end-user-doc -->
       * 
       * @see #getChannelNum()
       * @generated
       * @ordered
       */
      protected static final Short CHANNEL_NUM_EDEFAULT = null;
  
      /**
       * The cached value of the '{@link #getChannelNum() <em>Channel Num</em>}' attribute.
       * <!-- begin-user-doc -->
       * <!-- end-user-doc -->
       * 
       * @see #getChannelNum()
       * @generated
       * @ordered
       */
      protected Short channelNum = CHANNEL_NUM_EDEFAULT;
  
      private VoltageListener listener;
  
      private BrickletIndustrialDualAnalogIn tinkerforgeDevice;
  
      /**
       * <!-- begin-user-doc -->
       * <!-- end-user-doc -->
       * 
       * @generated
       */
      protected IndustrialDualAnalogInChannelImpl() {
          super();
      }
  
      /**
       * <!-- begin-user-doc -->
       * <!-- end-user-doc -->
       * 
       * @generated
       */
      @Override
      protected EClass eStaticClass() {
          return ModelPackage.Literals.INDUSTRIAL_DUAL_ANALOG_IN_CHANNEL;
      }
  
      /**
       * <!-- begin-user-doc -->
       * <!-- end-user-doc -->
       * 
       * @generated
       */
      @Override
      public DecimalValue getSensorValue() {
          return sensorValue;
      }
  
      /**
       * <!-- begin-user-doc -->
       * <!-- end-user-doc -->
       * 
       * @generated
       */
      @Override
      public void setSensorValue(DecimalValue newSensorValue) {
          DecimalValue oldSensorValue = sensorValue;
          sensorValue = newSensorValue;
          if (eNotificationRequired())
              eNotify(new ENotificationImpl(this, Notification.SET,
                      ModelPackage.INDUSTRIAL_DUAL_ANALOG_IN_CHANNEL__SENSOR_VALUE, oldSensorValue, sensorValue));
      }
  
      /**
       * <!-- begin-user-doc -->
       * <!-- end-user-doc -->
       * 
       * @generated
       */
      @Override
      public Logger getLogger() {
          return logger;
      }
  
      /**
       * <!-- begin-user-doc -->
       * <!-- end-user-doc -->
       * 
       * @generated
       */
      @Override
      public void setLogger(Logger newLogger) {
          Logger oldLogger = logger;
          logger = newLogger;
          if (eNotificationRequired())
              eNotify(new ENotificationImpl(this, Notification.SET,
                      ModelPackage.INDUSTRIAL_DUAL_ANALOG_IN_CHANNEL__LOGGER, oldLogger, logger));
      }
  
      /**
       * <!-- begin-user-doc -->
       * <!-- end-user-doc -->
       * 
       * @generated
       */
      @Override
      public String getUid() {
          return uid;
      }
  
      /**
       * <!-- begin-user-doc -->
       * <!-- end-user-doc -->
       * 
       * @generated
       */
      @Override
      public void setUid(String newUid) {
          String oldUid = uid;
          uid = newUid;
          if (eNotificationRequired())
              eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.INDUSTRIAL_DUAL_ANALOG_IN_CHANNEL__UID,
                      oldUid, uid));
      }
  
      /**
       * <!-- begin-user-doc -->
       * <!-- end-user-doc -->
       * 
       * @generated
       */
      @Override
      public boolean isPoll() {
          return poll;
      }
  
      /**
       * <!-- begin-user-doc -->
       * <!-- end-user-doc -->
       * 
       * @generated
       */
      @Override
      public void setPoll(boolean newPoll) {
          boolean oldPoll = poll;
          poll = newPoll;
          if (eNotificationRequired())
              eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.INDUSTRIAL_DUAL_ANALOG_IN_CHANNEL__POLL,
                      oldPoll, poll));
      }
  
      /**
       * <!-- begin-user-doc -->
       * <!-- end-user-doc -->
       * 
       * @generated
       */
      @Override
      public AtomicBoolean getEnabledA() {
          return enabledA;
      }
  
      /**
       * <!-- begin-user-doc -->
       * <!-- end-user-doc -->
       * 
       * @generated
       */
      @Override
      public void setEnabledA(AtomicBoolean newEnabledA) {
          AtomicBoolean oldEnabledA = enabledA;
          enabledA = newEnabledA;
          if (eNotificationRequired())
              eNotify(new ENotificationImpl(this, Notification.SET,
                      ModelPackage.INDUSTRIAL_DUAL_ANALOG_IN_CHANNEL__ENABLED_A, oldEnabledA, enabledA));
      }
  
      /**
       * <!-- begin-user-doc -->
       * <!-- end-user-doc -->
       * 
       * @generated
       */
      @Override
      public String getSubId() {
          return subId;
      }
  
      /**
       * <!-- begin-user-doc -->
       * <!-- end-user-doc -->
       * 
       * @generated
       */
      @Override
      public void setSubId(String newSubId) {
          String oldSubId = subId;
          subId = newSubId;
          if (eNotificationRequired())
              eNotify(new ENotificationImpl(this, Notification.SET,
                      ModelPackage.INDUSTRIAL_DUAL_ANALOG_IN_CHANNEL__SUB_ID, oldSubId, subId));
      }
  
      /**
       * <!-- begin-user-doc -->
       * <!-- end-user-doc -->
       * 
       * @generated
       */
      @Override
      public MBrickletIndustrialDualAnalogIn getMbrick() {
          if (eContainerFeatureID() != ModelPackage.INDUSTRIAL_DUAL_ANALOG_IN_CHANNEL__MBRICK)
              return null;
          return (MBrickletIndustrialDualAnalogIn) eContainer();
      }
  
      /**
       * <!-- begin-user-doc -->
       * <!-- end-user-doc -->
       * 
       * @generated
       */
      public MBrickletIndustrialDualAnalogIn basicGetMbrick() {
          if (eContainerFeatureID() != ModelPackage.INDUSTRIAL_DUAL_ANALOG_IN_CHANNEL__MBRICK)
              return null;
          return (MBrickletIndustrialDualAnalogIn) eInternalContainer();
      }
  
      /**
       * <!-- begin-user-doc -->
       * <!-- end-user-doc -->
       * 
       * @generated
       */
      public NotificationChain basicSetMbrick(MBrickletIndustrialDualAnalogIn newMbrick, NotificationChain msgs) {
          msgs = eBasicSetContainer((InternalEObject) newMbrick, ModelPackage.INDUSTRIAL_DUAL_ANALOG_IN_CHANNEL__MBRICK,
                  msgs);
          return msgs;
      }
  
      /**
       * <!-- begin-user-doc -->
       * <!-- end-user-doc -->
       * 
       * @generated
       */
      @Override
      public void setMbrick(MBrickletIndustrialDualAnalogIn newMbrick) {
          if (newMbrick != eInternalContainer()
                  || (eContainerFeatureID() != ModelPackage.INDUSTRIAL_DUAL_ANALOG_IN_CHANNEL__MBRICK
                          && newMbrick != null)) {
              if (EcoreUtil.isAncestor(this, newMbrick))
                  throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
              NotificationChain msgs = null;
              if (eInternalContainer() != null)
                  msgs = eBasicRemoveFromContainer(msgs);
              if (newMbrick != null)
                  msgs = ((InternalEObject) newMbrick).eInverseAdd(this, ModelPackage.MSUB_DEVICE_HOLDER__MSUBDEVICES,
                          MSubDeviceHolder.class, msgs);
              msgs = basicSetMbrick(newMbrick, msgs);
              if (msgs != null)
                  msgs.dispatch();
          } else if (eNotificationRequired())
              eNotify(new ENotificationImpl(this, Notification.SET,
                      ModelPackage.INDUSTRIAL_DUAL_ANALOG_IN_CHANNEL__MBRICK, newMbrick, newMbrick));
      }
  
      /**
       * <!-- begin-user-doc -->
       * <!-- end-user-doc -->
       * 
       * @generated
       */
      @Override
      public TFBaseConfiguration getTfConfig() {
          return tfConfig;
      }
  
      /**
       * <!-- begin-user-doc -->
       * <!-- end-user-doc -->
       * 
       * @generated
       */
      public NotificationChain basicSetTfConfig(TFBaseConfiguration newTfConfig, NotificationChain msgs) {
          TFBaseConfiguration oldTfConfig = tfConfig;
          tfConfig = newTfConfig;
          if (eNotificationRequired()) {
              ENotificationImpl notification = new ENotificationImpl(this, Notification.SET,
                      ModelPackage.INDUSTRIAL_DUAL_ANALOG_IN_CHANNEL__TF_CONFIG, oldTfConfig, newTfConfig);
              if (msgs == null)
                  msgs = notification;
              else
                  msgs.add(notification);
          }
          return msgs;
      }
  
      /**
       * <!-- begin-user-doc -->
       * <!-- end-user-doc -->
       * 
       * @generated
       */
      @Override
      public void setTfConfig(TFBaseConfiguration newTfConfig) {
          if (newTfConfig != tfConfig) {
              NotificationChain msgs = null;
              if (tfConfig != null)
                  msgs = ((InternalEObject) tfConfig).eInverseRemove(this,
                          EOPPOSITE_FEATURE_BASE - ModelPackage.INDUSTRIAL_DUAL_ANALOG_IN_CHANNEL__TF_CONFIG, null, msgs);
              if (newTfConfig != null)
                  msgs = ((InternalEObject) newTfConfig).eInverseAdd(this,
                          EOPPOSITE_FEATURE_BASE - ModelPackage.INDUSTRIAL_DUAL_ANALOG_IN_CHANNEL__TF_CONFIG, null, msgs);
              msgs = basicSetTfConfig(newTfConfig, msgs);
              if (msgs != null)
                  msgs.dispatch();
          } else if (eNotificationRequired())
              eNotify(new ENotificationImpl(this, Notification.SET,
                      ModelPackage.INDUSTRIAL_DUAL_ANALOG_IN_CHANNEL__TF_CONFIG, newTfConfig, newTfConfig));
      }
  
      /**
       * <!-- begin-user-doc -->
       * <!-- end-user-doc -->
       * 
       * @generated
       */
      @Override
      public long getCallbackPeriod() {
          return callbackPeriod;
      }
  
      /**
       * <!-- begin-user-doc -->
       * <!-- end-user-doc -->
       * 
       * @generated
       */
      @Override
      public void setCallbackPeriod(long newCallbackPeriod) {
          long oldCallbackPeriod = callbackPeriod;
          callbackPeriod = newCallbackPeriod;
          if (eNotificationRequired())
              eNotify(new ENotificationImpl(this, Notification.SET,
                      ModelPackage.INDUSTRIAL_DUAL_ANALOG_IN_CHANNEL__CALLBACK_PERIOD, oldCallbackPeriod,
                      callbackPeriod));
      }
  
      /**
       * <!-- begin-user-doc -->
       * <!-- end-user-doc -->
       * 
       * @generated
       */
      @Override
      public String getDeviceType() {
          return deviceType;
      }
  
      /**
       * <!-- begin-user-doc -->
       * <!-- end-user-doc -->
       * 
       * @generated
       */
      @Override
      public BigDecimal getThreshold() {
          return threshold;
      }
  
      /**
       * <!-- begin-user-doc -->
       * <!-- end-user-doc -->
       * 
       * @generated
       */
      @Override
      public void setThreshold(BigDecimal newThreshold) {
          BigDecimal oldThreshold = threshold;
          threshold = newThreshold;
          if (eNotificationRequired())
              eNotify(new ENotificationImpl(this, Notification.SET,
                      ModelPackage.INDUSTRIAL_DUAL_ANALOG_IN_CHANNEL__THRESHOLD, oldThreshold, threshold));
      }
  
      /**
       * <!-- begin-user-doc -->
       * <!-- end-user-doc -->
       * 
       * @generated
       */
      @Override
      public Short getChannelNum() {
          return channelNum;
      }
  
      /**
       * <!-- begin-user-doc -->
       * <!-- end-user-doc -->
       * 
       * @generated
       */
      @Override
      public void setChannelNum(Short newChannelNum) {
          Short oldChannelNum = channelNum;
          channelNum = newChannelNum;
          if (eNotificationRequired())
              eNotify(new ENotificationImpl(this, Notification.SET,
                      ModelPackage.INDUSTRIAL_DUAL_ANALOG_IN_CHANNEL__CHANNEL_NUM, oldChannelNum, channelNum));
      }
  
      /**
       * <!-- begin-user-doc -->
       * <!-- end-user-doc -->
       * 
       * @generated NOT
       */
      @Override
      public void init() {
          setEnabledA(new AtomicBoolean());
          logger = LoggerFactory.getLogger(IndustrialDualAnalogInChannelImpl.class);
      }
  
      /**
       * <!-- begin-user-doc -->
       * <!-- end-user-doc -->
       * 
       * @generated NOT
       */
      @Override
      public void enable() {
          if (tfConfig != null) {
              if (tfConfig.eIsSet(tfConfig.eClass().getEStructuralFeature("threshold"))) {
                  logger.debug("threshold {}", tfConfig.getThreshold());
                  setThreshold(tfConfig.getThreshold());
              }
              if (tfConfig.eIsSet(tfConfig.eClass().getEStructuralFeature("callbackPeriod"))) {
  