/**
  *
  * <!-- begin-user-doc -->
  * <!-- end-user-doc -->
  *
  * @generated NOT
  */
 @Override
 public void disable() {
   if (listener != null) {
     tinkerforgeDevice.removeDustDensityListener(listener);
   }
   tinkerforgeDevice = null;
 }
 /**
  *
  * <!-- begin-user-doc -->
  * <!-- end-user-doc -->
  *
  * @generated NOT
  */
 @Override
 public void fetchSensorValue() {
   try {
     int dustDensity = tinkerforgeDevice.getDustDensity();
     DecimalValue value = Tools.calculate(dustDensity);
     setSensorValue(value);
   } catch (TimeoutException e) {
     TinkerforgeErrorHandler.handleError(this, TinkerforgeErrorHandler.TF_TIMEOUT_EXCEPTION, e);
   } catch (NotConnectedException e) {
     TinkerforgeErrorHandler.handleError(
         this, TinkerforgeErrorHandler.TF_NOT_CONNECTION_EXCEPTION, e);
   }
 }
 /**
  *
  * <!-- begin-user-doc -->
  * <!-- end-user-doc -->
  *
  * @generated NOT
  */
 @Override
 public void enable() {
   if (tfConfig != null) {
     if (tfConfig.eIsSet(tfConfig.eClass().getEStructuralFeature("threshold"))) {
       setThreshold(tfConfig.getThreshold());
     }
     if (tfConfig.eIsSet(tfConfig.eClass().getEStructuralFeature("callbackPeriod"))) {
       setCallbackPeriod(tfConfig.getCallbackPeriod());
     }
   }
   try {
     tinkerforgeDevice = new BrickletDustDetector(getUid(), getIpConnection());
     tinkerforgeDevice.setDustDensityCallbackPeriod(getCallbackPeriod());
     listener = new DustDensityListener();
     tinkerforgeDevice.addDustDensityListener(listener);
     fetchSensorValue();
   } catch (TimeoutException e) {
     TinkerforgeErrorHandler.handleError(this, TinkerforgeErrorHandler.TF_TIMEOUT_EXCEPTION, e);
   } catch (NotConnectedException e) {
     TinkerforgeErrorHandler.handleError(
         this, TinkerforgeErrorHandler.TF_NOT_CONNECTION_EXCEPTION, e);
   }
 }